odysseus-dev/odysseus · error · HTTPException
Missing image Content-ID
Error message
Missing image Content-ID
What it means
Guard in compose attachment staging: the uploaded file exceeds EMAIL_COMPOSE_UPLOAD_MAX_BYTES. Raised as 413 before the bytes are written to the compose staging directory, so oversized attachments never hit disk. Fires when users attach files larger than the configured compose upload limit.
Solutions
- Pass the Content-ID of the inline image in the request.
- Inspect the email HTML for the cid: reference and use that identifier.
Defensive patterns
Strategy: validation
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.
Appendix: 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)