{"record":{"id":"997dfb3f281fa8c6","repo":"odysseus-dev/odysseus","slug":"document-not-found-997dfb","errorCode":null,"errorMessage":"Document not found","messagePattern":"Document not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4076,"sourceCode":"            raise HTTPException(status_code=404, detail=\"File not found\")\n        size = src.stat().st_size\n        if size > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:\n            raise HTTPException(status_code=413, detail=\"Attachment too large\")\n        safe_name = _safe_compose_filename(filename)\n        token = f\"{uuid.uuid4().hex}_{safe_name}\"\n        dest = COMPOSE_UPLOADS_DIR / token\n        import shutil as _shutil\n        _shutil.copyfile(str(src), str(dest))\n        return {\"success\": True, \"token\": token, \"filename\": safe_name, \"size\": size}\n\n    def _load_odysseus_attachment_source(db, kind: str, item_id: str, owner: str):\n        from core.database import Document as _Doc, GalleryImage as _GI\n        from core.database import Session as _Sess\n\n        if kind == \"document\":\n            doc = db.query(_Doc).filter(_Doc.id == item_id, _Doc.is_active == True).first()\n            if not doc:\n                raise HTTPException(status_code=404, detail=\"Document not found\")\n            if owner:\n                if doc.owner and doc.owner != owner:\n                    raise HTTPException(status_code=404, detail=\"Document not found\")\n                if not doc.owner and doc.session_id:\n                    sess = db.query(_Sess).filter(_Sess.id == doc.session_id).first()\n                    if sess and sess.owner and sess.owner != owner:\n                        raise HTTPException(status_code=404, detail=\"Document not found\")\n            lang = (doc.language or \"text\").strip().lower()\n            ext = {\n                \"markdown\": \"md\",\n                \"email\": \"eml\",\n                \"json\": \"json\",\n                \"yaml\": \"yaml\",\n                \"yml\": \"yml\",\n                \"html\": \"html\",\n                \"csv\": \"csv\",\n                \"xml\": \"xml\",\n                \"text\": \"txt\",","sourceCodeStart":4058,"sourceCodeEnd":4094,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4058-L4094","documentation":"Error \"Document not found\" thrown in odysseus-dev/odysseus.","triggerScenarios":"Triggered when the corresponding server-side validation or runtime check at the recorded location rejects the request or operation and returns this error message to the caller.","commonSituations":"See trigger scenarios.","solutions":["Refresh the document list; the document may have been deleted.","Verify the document id is correct."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}