{"record":{"id":"a57023b1e82aa289","repo":"odysseus-dev/odysseus","slug":"expected-kind-and-id","errorCode":null,"errorMessage":"Expected kind and id","messagePattern":"Expected kind and id","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4121,"sourceCode":"            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:\n                db.close()\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Failed to stage Odysseus attachment {kind}/{item_id}: {e}\")\n            return {\"success\": False, \"error\": \"Mail operation failed\"}\n\n    @router.post(\"/compose-from-odysseus-zip\")","sourceCodeStart":4103,"sourceCodeEnd":4139,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4103-L4139","documentation":"Error \"Expected kind and id\" 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":["Include both kind and id for each attachment in the request.","Fix the client code building the attachment list."],"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"}