{"record":{"id":"3d96a1f95b122631","repo":"HKUDS/DeepTutor","slug":"attachment-not-found","errorCode":null,"errorMessage":"Attachment not found","messagePattern":"Attachment not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/attachments.py","lineNumber":66,"sourceCode":"    Responds with ``Content-Disposition: inline`` so browsers preview PDFs\n    and images directly in an ``<iframe>`` / ``<img>``. For unknown types\n    the browser still falls back to download, which is fine for the\n    drawer's \"Download\" button path.\n    \"\"\"\n    store = get_attachment_store()\n    if not isinstance(store, LocalDiskAttachmentStore):\n        # Future remote backends should issue a redirect to the signed URL\n        # here. Local-disk is the only backend today, so this branch just\n        # guards against an unexpected configuration.\n        raise HTTPException(status_code=501, detail=\"Attachment backend not servable\")\n\n    target = store.resolve_path(\n        session_id=session_id,\n        attachment_id=attachment_id,\n        filename=filename,\n    )\n    if target is None:\n        raise HTTPException(status_code=404, detail=\"Attachment not found\")\n\n    media_type, _ = mimetypes.guess_type(target.name)\n    if not media_type:\n        media_type = \"application/octet-stream\"\n\n    # ``inline`` lets the browser preview the file when possible while still\n    # honouring the suggested filename for the drawer's download action.\n    headers = {\n        \"Content-Disposition\": _content_disposition(target.name),\n        # User-uploaded data; do not let intermediaries cache it.\n        \"Cache-Control\": \"private, max-age=0, must-revalidate\",\n    }\n    return FileResponse(path=str(target), media_type=media_type, headers=headers)\n","sourceCodeStart":48,"sourceCodeEnd":80,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/attachments.py#L48-L80","documentation":"Error \"Attachment not found\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/attachments.py:66 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"}