HKUDS/DeepTutor · error · HTTPException
Link not found
Error message
Link not found
What it means
Lookup guard: the entry-to-category link identified by the request could not be found in the store, so the referenced relation (not the entry or category itself) is the missing entity. Fires when deleting or updating a link that was already removed or never created.
Solutions
- Confirm the link exists with a GET before deleting or updating it
- Treat 'link not found' on delete as idempotent success when retrying a cleanup
- Check the entry_id and category_id are the same pair used when the link was created
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at deeptutor/api/routers/question_notebook.py:341 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/2c3ced30aa8aa2c4.
Report an issue: GitHub.
Appendix: source
Thrown at deeptutor/api/routers/question_notebook.py:341
@router.post("/entries/{entry_id}/categories")
async def add_entry_to_category(entry_id: int, payload: CategoryAddRequest):
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")
ok = await store.add_entry_to_category(entry_id, payload.category_id)
if not ok:
raise HTTPException(status_code=400, detail="Failed to add to category")
return {"added": True, "entry_id": entry_id, "category_id": payload.category_id}
@router.delete("/entries/{entry_id}/categories/{category_id}")
async def remove_entry_from_category(entry_id: int, category_id: int):
store = get_sqlite_session_store()
removed = await store.remove_entry_from_category(entry_id, category_id)
if not removed:
raise HTTPException(status_code=404, detail="Link not found")
return {"removed": True, "entry_id": entry_id, "category_id": category_id}
# ── Overview ─────────────────────────────────────────────────────
@router.get("/stats", response_model=QuestionBankStats)
async def question_bank_stats() -> QuestionBankStats:
"""Counts behind the filter chips; also the agent's one-call overview."""
store = get_sqlite_session_store()
return QuestionBankStats(**await store.question_bank_stats())
# ── Category CRUD ────────────────────────────────────────────────
@router.get("/categories", response_model=list[CategoryItem])
async def list_categories():View on GitHub (pinned to 3e82f13042)