{"record":{"id":"2d2e38aac111e3c7","repo":"HKUDS/DeepTutor","slug":"annotation-not-found","errorCode":null,"errorMessage":"annotation not found","messagePattern":"annotation not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/reading.py","lineNumber":301,"sourceCode":"async def save_annotation(material_id: str, payload: AnnotationPayload) -> AnnotationInfo:\n    \"\"\"Create or update one annotation (id absent = create).\"\"\"\n    store = _store()\n    try:\n        saved = store.save_annotation(material_id, payload.to_annotation())\n    except Exception as exc:\n        raise _http_error(exc) from exc\n    return _annotation_info(saved)\n\n\n@router.delete(\"/materials/{material_id}/annotations/{annotation_id}\")\nasync def delete_annotation(material_id: str, annotation_id: str) -> dict[str, Any]:\n    store = _store()\n    try:\n        removed = store.delete_annotation(material_id, annotation_id)\n    except Exception as exc:\n        raise _http_error(exc) from exc\n    if not removed:\n        raise HTTPException(status_code=404, detail=\"annotation not found\")\n    return {\"status\": \"ok\", \"annotation_id\": annotation_id}\n\n\n@router.get(\"/materials/{material_id}/export\")\nasync def export(\n    material_id: str,\n    fmt: Literal[\"auto\", \"pdf\", \"markdown\"] = Query(\"auto\"),\n) -> Response:\n    \"\"\"Download the material with its annotations applied.\n\n    ``pdf`` writes real PDF annotations into a copy of the original, so the\n    export keeps working outside DeepTutor; ``markdown`` returns the marks as\n    text, which is what every non-PDF format gets.\n    \"\"\"\n    store = _store()\n    try:\n        result = export_material(store, material_id, fmt=fmt)\n    except Exception as exc:","sourceCodeStart":283,"sourceCodeEnd":319,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/reading.py#L283-L319","documentation":"Error \"annotation not found\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/reading.py:301 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}