diff --git a/drb-c2-core/app/routers/admin.py b/drb-c2-core/app/routers/admin.py index 21df096..2291044 100644 --- a/drb-c2-core/app/routers/admin.py +++ b/drb-c2-core/app/routers/admin.py @@ -129,7 +129,14 @@ async def debug_correlation( unique_call_ids = list(dict.fromkeys(all_call_ids)) # dedupe, preserve order call_docs = await asyncio.gather(*(fstore.doc_get("calls", cid) for cid in unique_call_ids)) - call_map: dict[str, dict] = {doc["call_id"]: doc for doc in call_docs if doc} + # Key off the id we asked for, not doc["call_id"]. At least one stored call + # has no call_id field -- the document id is authoritative and always + # present, while the field is written by the upload path and evidently was + # not always there. Indexing the field raised KeyError and took the whole + # debug view down with a 500 over a single malformed document. + call_map: dict[str, dict] = { + cid: doc for cid, doc in zip(unique_call_ids, call_docs) if doc + } # ── Build incident debug records ────────────────────────────────────────── incident_records = []