odysseus-dev/odysseus · error · HTTPException

Expected kind and id

Error message

Expected kind and id

What it means

Error "Expected kind and id" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4121

            if not img:
                raise HTTPException(status_code=404, detail="Image not found")
            if owner and img.owner and img.owner != owner:
                raise HTTPException(status_code=404, detail="Image not found")
            from routes.gallery.gallery_routes import _gallery_image_path
            src = _gallery_image_path(img.filename)
            if not src.exists() or not src.is_file():
                raise HTTPException(status_code=404, detail="Image file not found")
            return {"filename": _safe_compose_filename(img.filename or "gallery-image.png"), "path": src}

        raise HTTPException(status_code=400, detail="Unknown attachment kind")

    @router.post("/compose-from-odysseus")
    async def compose_from_odysseus(data: dict, owner: str = Depends(require_owner)):
        """Stage an Odysseus document or gallery image as a compose upload."""
        kind = str(data.get("kind") or "").strip().lower()
        item_id = str(data.get("id") or "").strip()
        if kind not in {"document", "gallery"} or not item_id:
            raise HTTPException(status_code=400, detail="Expected kind and id")
        try:
            from core.database import SessionLocal as _SL

            db = _SL()
            try:
                src = _load_odysseus_attachment_source(db, kind, item_id, owner)
                if "path" in src:
                    return _stage_compose_file(src["filename"], src["path"])
                return _stage_compose_bytes(src["filename"], src["content"])
            finally:
                db.close()
        except HTTPException:
            raise
        except Exception as e:
            logger.error(f"Failed to stage Odysseus attachment {kind}/{item_id}: {e}")
            return {"success": False, "error": "Mail operation failed"}

    @router.post("/compose-from-odysseus-zip")

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Include both kind and id for each attachment in the request.
  2. Fix the client code building the attachment list.

When it happens

Trigger: 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.

Common situations: See trigger scenarios.


AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14). Data as JSON: /api/errors/a57023b1e82aa289. Report an issue: GitHub.