You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(routing): 404 on batch document lookup doesn't identify which doc_id failed, forcing binary search on callers #277
When one of N document IDs in a route request is not found, route_query() raises document_not_found() with a generic 404 message that does not include the failing doc_id. With up to 25 document IDs in a batch request, the caller cannot identify which one is missing without performing a binary search.
Root Cause
backend/app/api/routing.py around line 96:
docs=awaitasyncio.gather(*[_fetch_doc(doc_id, ...) fordoc_idindocument_ids])
fordocindocs:
ifdocisNone:
raisedocument_not_found() # ← which doc_id? No information provided
The doc_id corresponding to the None result is lost because the index into docs is not tracked alongside the fetch result.
Failure Scenario
Caller submits 25 document_ids to batch-route a query.
One of them — say document_ids[17] — was deleted 3 days ago.
The response is 404 {"code": "DOCUMENT_NOT_FOUND", "message": "No document with the given id exists."}.
Caller cannot tell which of 25 IDs failed.
Caller must make 25 individual /documents/{id} requests to binary-search for the missing one.
Activity
piyushmakhija28 commentedon Jun 21, 2026
Fixed in PR #280 (Sprint R3/R4: fix(sprint-r3): root-cause fixes for all 39 bugs from code review round 3 + Sprint R4 round 4)