HKUDS/DeepTutor · error · HTTPException
Entry not found
Error message
Entry not found
What it means
Sentinel 404 from GET /entries/lookup/by-question: no notebook entry matches the (session_id, question_id[, turn_id]) query — the question has not been saved yet. Callers probing preemptively pass missing_ok=true to get 204 instead of this noisy 404.
Solutions
- Set missing_ok=true when probing for not-yet-saved questions (quiz viewer use case)
- Ensure the answer was upserted before looking it up
- If turn_id was passed, retry without it to match across turns
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at deeptutor/api/routers/question_notebook.py:273 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/ea7b7dd7b8ec915b.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/question_notebook.py:273
@router.get("/entries/lookup/by-question")
async def lookup_entry(
session_id: str = Query(...),
question_id: str = Query(...),
turn_id: str | None = Query(default=None),
missing_ok: bool = Query(
default=False,
description="Return 204 No Content instead of 404 when the entry is "
"absent — used by the quiz viewer to probe not-yet-saved questions "
"without logging noisy 404s.",
),
):
store = get_sqlite_session_store()
entry = await store.find_notebook_entry(session_id, question_id, turn_id=turn_id)
if entry is None:
if missing_ok:
return Response(status_code=204)
raise HTTPException(status_code=404, detail="Entry not found")
return entry
@router.get("/entries/{entry_id}", response_model=NotebookEntryItem)
async def get_entry(entry_id: int) -> NotebookEntryItem:
store = get_sqlite_session_store()
entry = await store.get_notebook_entry(entry_id)
if entry is None:
raise HTTPException(status_code=404, detail="Entry not found")
return NotebookEntryItem(**entry)
@router.patch("/entries/{entry_id}")
async def update_entry(entry_id: int, payload: EntryUpdateRequest):
store = get_sqlite_session_store()
updates = payload.model_dump(exclude_none=True)
if not updates:
raise HTTPException(status_code=400, detail="No fields to update")View on GitHub (pinned to 3e82f13042)