{"record":{"id":"c640593dfcd16f44","repo":"odysseus-dev/odysseus","slug":"unknown-attachment-kind","errorCode":null,"errorMessage":"Unknown attachment kind","messagePattern":"Unknown attachment kind","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4113,"sourceCode":"            }.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:\n                    return _stage_compose_file(src[\"filename\"], src[\"path\"])\n                return _stage_compose_bytes(src[\"filename\"], src[\"content\"])\n            finally:","sourceCodeStart":4095,"sourceCodeEnd":4131,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4095-L4131","documentation":"Error \"Unknown attachment kind\" 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":["Use a supported attachment kind (e.g. upload, document, image).","Check the request payload for a typo in the kind field."],"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"}