{"record":{"id":"83f2c70c73e0268d","repo":"odysseus-dev/odysseus","slug":"image-file-not-found","errorCode":null,"errorMessage":"Image file not found","messagePattern":"Image file not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4110,"sourceCode":"                \"csv\": \"csv\",\n                \"xml\": \"xml\",\n                \"text\": \"txt\",\n            }.get(lang, \"txt\")\n            base = _safe_compose_filename(doc.title or \"document\", \"document\")\n            if not base.lower().endswith(f\".{ext}\"):\n                base = f\"{base}.{ext}\"\n            return {\"filename\": base, \"content\": (doc.current_content or \"\").encode(\"utf-8\")}\n\n        if kind == \"gallery\":\n            img = db.query(_GI).filter(_GI.id == item_id, _GI.is_active == True).first()\n            if not img:\n                raise HTTPException(status_code=404, detail=\"Image not found\")\n            if owner and img.owner and img.owner != owner:\n                raise HTTPException(status_code=404, detail=\"Image not found\")\n            from routes.gallery.gallery_routes import _gallery_image_path\n            src = _gallery_image_path(img.filename)\n            if not src.exists() or not src.is_file():\n                raise HTTPException(status_code=404, detail=\"Image file not found\")\n            return {\"filename\": _safe_compose_filename(img.filename or \"gallery-image.png\"), \"path\": src}\n\n        raise HTTPException(status_code=400, detail=\"Unknown attachment kind\")\n\n    @router.post(\"/compose-from-odysseus\")\n    async def compose_from_odysseus(data: dict, owner: str = Depends(require_owner)):\n        \"\"\"Stage an Odysseus document or gallery image as a compose upload.\"\"\"\n        kind = str(data.get(\"kind\") or \"\").strip().lower()\n        item_id = str(data.get(\"id\") or \"\").strip()\n        if kind not in {\"document\", \"gallery\"} or not item_id:\n            raise HTTPException(status_code=400, detail=\"Expected kind and id\")\n        try:\n            from core.database import SessionLocal as _SL\n\n            db = _SL()\n            try:\n                src = _load_odysseus_attachment_source(db, kind, item_id, owner)\n                if \"path\" in src:","sourceCodeStart":4092,"sourceCodeEnd":4128,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4092-L4128","documentation":"Error \"Image file 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":["The image record exists but its file is missing on disk; restore it from backup or re-upload.","Check storage paths and permissions for the gallery directory."],"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-15T22:17:37.221Z"}