odysseus-dev/odysseus · error · HTTPException

Attachment too large

Error message

Attachment too large

What it means

Error "Attachment too large" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:4048

            return {
                "success": True,
                "token": token,
                "filename": safe_name,
                "size": len(content),
            }
        except HTTPException:
            raise
        except Exception as e:
            logger.error(f"Failed to upload attachment: {e}")
            return {"success": False, "error": "Mail operation failed"}

    def _safe_compose_filename(name: str, fallback: str = "attachment") -> str:
        safe_name = re.sub(r"[^\w\s\-.]", "_", Path(str(name or fallback)).name).strip(". ")[:180]
        return safe_name or fallback

    def _stage_compose_bytes(filename: str, content: bytes) -> dict:
        if len(content) > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:
            raise HTTPException(status_code=413, detail="Attachment too large")
        safe_name = _safe_compose_filename(filename)
        token = f"{uuid.uuid4().hex}_{safe_name}"
        filepath = COMPOSE_UPLOADS_DIR / token
        with open(filepath, "wb") as f:
            f.write(content)
        return {"success": True, "token": token, "filename": safe_name, "size": len(content)}

    def _stage_compose_file(filename: str, src: Path) -> dict:
        if not src.exists() or not src.is_file():
            raise HTTPException(status_code=404, detail="File not found")
        size = src.stat().st_size
        if size > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:
            raise HTTPException(status_code=413, detail="Attachment too large")
        safe_name = _safe_compose_filename(filename)
        token = f"{uuid.uuid4().hex}_{safe_name}"
        dest = COMPOSE_UPLOADS_DIR / token
        import shutil as _shutil
        _shutil.copyfile(str(src), str(dest))

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Download attachments individually instead of as an archive.
  2. Ask the server administrator about raising the size limit, or fetch a smaller subset.

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