odysseus-dev/odysseus · error · HTTPException

Expected items

Error message

Expected items

What it means

Error "Expected items" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4144

            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")
    async def compose_from_odysseus_zip(data: dict, owner: str = Depends(require_owner)):
        """Stage several Odysseus documents/gallery images as one zip attachment."""
        raw_items = data.get("items") or []
        if not isinstance(raw_items, list) or not raw_items:
            raise HTTPException(status_code=400, detail="Expected items")
        if len(raw_items) > 100:
            raise HTTPException(status_code=400, detail="Too many attachments")
        try:
            from core.database import SessionLocal as _SL

            db = _SL()
            try:
                buf = io.BytesIO()
                used_names: dict[str, int] = {}

                def unique_name(name: str) -> str:
                    safe = _safe_attachment_zip_name(name, "attachment")
                    stem = Path(safe).stem or "attachment"
                    suffix = Path(safe).suffix
                    idx = used_names.get(safe, 0)
                    used_names[safe] = idx + 1
                    if idx == 0:
                        return safe

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Send an items array in the request body.
  2. Check the client payload shape matches the API contract.

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