{"record":{"id":"b54c8420fd814452","repo":"HKUDS/DeepTutor","slug":"attachment-backend-not-servable","errorCode":null,"errorMessage":"Attachment backend not servable","messagePattern":"Attachment backend not servable","errorType":"http","errorClass":"HTTPException","httpStatus":501,"severity":"error","filePath":"deeptutor/api/routers/attachments.py","lineNumber":58,"sourceCode":"@router.get(\"/{session_id}/{attachment_id}/{filename:path}\")\nasync def get_attachment(\n    session_id: str,\n    attachment_id: str,\n    filename: str,\n):\n    \"\"\"Serve a previously uploaded chat attachment.\n\n    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.","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/attachments.py#L40-L76","documentation":"Error \"Attachment backend not servable\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/attachments.py:58 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"}