odysseus-dev/odysseus · error · HTTPException

Too many attachments

Error message

Too many attachments

What it means

Error "Too many attachments" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4146

                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
                    return f"{stem}-{idx + 1}{suffix}"

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Reduce the number of attachments and send multiple messages instead.
  2. Compress or link large sets of files rather than attaching them all.

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