odysseus-dev/odysseus · error · HTTPException

Missing image Content-ID

Error message

Missing image Content-ID

What it means

Error "Missing image Content-ID" thrown in odysseus-dev/odysseus.

Source

Thrown at routes/email_routes.py:3391

            )
        except HTTPException:
            raise
        except Exception as e:
            logger.error(f"Failed to download attachments zip {uid}: {e}")
            raise HTTPException(status_code=500, detail="Mail operation failed")

    @router.get("/inline-image/{uid}")
    async def inline_image(
        uid: str,
        cid: str = Query(...),
        folder: str = Query("INBOX"),
        account_id: str | None = Query(None),
        owner: str = Depends(require_owner),
    ):
        """Serve an inline MIME image by Content-ID after the user explicitly clicks Load."""
        want = (cid or "").strip().strip("<>")
        if not want:
            raise HTTPException(status_code=400, detail="Missing image Content-ID")
        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)
            idx = 0
            for part in msg.walk():
                cd = str(part.get("Content-Disposition", ""))
                ct = part.get_content_type()
                is_attached_email = ct == "message/rfc822" and ("attachment" in cd.lower() or part.get_filename())
                if part.is_multipart() and not is_attached_email:
                    continue
                if ct in ("text/plain", "text/html") and "attachment" not in cd:
                    continue
                content_id = (part.get("Content-ID") or "").strip().strip("<>")

View on GitHub (pinned to f9235ebbf1)

Solutions

  1. Pass the Content-ID of the inline image in the request.
  2. Inspect the email HTML for the cid: reference and use that identifier.

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