odysseus-dev/odysseus · error · HTTPException

Unknown attachment kind

Error message

Unknown attachment kind

What it means

Error "Unknown attachment kind" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4113

            }.get(lang, "txt")
            base = _safe_compose_filename(doc.title or "document", "document")
            if not base.lower().endswith(f".{ext}"):
                base = f"{base}.{ext}"
            return {"filename": base, "content": (doc.current_content or "").encode("utf-8")}

        if kind == "gallery":
            img = db.query(_GI).filter(_GI.id == item_id, _GI.is_active == True).first()
            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:

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Use a supported attachment kind (e.g. upload, document, image).
  2. Check the request payload for a typo in the kind field.

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/c640593dfcd16f44. Report an issue: GitHub.