odysseus-dev/odysseus · error · HTTPException

No downloadable attachments

Error message

No downloadable attachments

What it means

Error "No downloadable attachments" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:3343

            return {"error": "Mail operation failed"}

    @router.get("/attachments-download/{uid}")
    async def download_all_attachments(uid: str, folder: str = Query("INBOX"), account_id: str | None = Query(None), owner: str = Depends(require_owner)):
        """Download all visible attachments for an email as a zip archive."""
        try:
            with _imap(account_id, owner=owner) as conn:
                conn.select(_q(folder), readonly=True)
                status, msg_data = _imap_uid_fetch(conn, uid, "(RFC822)")
            if status != "OK":
                raise HTTPException(status_code=404, detail="Email not found")
            raw = msg_data[0][1]
            msg = email_mod.message_from_bytes(raw)
            attachments = [
                att for att in _list_attachments_from_msg(msg)
                if not _is_likely_signature_image_attachment(att)
            ]
            if not attachments:
                raise HTTPException(status_code=404, detail="No downloadable attachments")

            target_dir = attachment_extract_dir(folder, uid)
            zip_buf = io.BytesIO()
            used_names: dict[str, int] = {}
            with zipfile.ZipFile(zip_buf, "w", compression=zipfile.ZIP_DEFLATED) as zf:
                for att in attachments:
                    idx = att.get("index")
                    if idx is None:
                        continue
                    filepath = _extract_attachment_to_disk(msg, int(idx), target_dir)
                    if not filepath or not Path(filepath).exists():
                        continue
                    fallback = f"attachment-{idx}"
                    arcname = _safe_attachment_zip_name(att.get("filename") or Path(filepath).name, fallback)
                    stem = Path(arcname).stem
                    suffix = Path(arcname).suffix
                    seen = used_names.get(arcname, 0)
                    used_names[arcname] = seen + 1

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. The email has no attachments to download; check the message in a mail client.
  2. Refresh the message; attachment metadata may have changed.

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