odysseus-dev/odysseus · error · HTTPException
Content-ID is not an image
Error message
Content-ID is not an image
What it means
Error "Content-ID is not an image" thrown in odysseus-dev/odysseus.
Source
Thrown at routes/email_routes.py:3414
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("<>")
if content_id != want:
idx += 1
continue
if not ct.lower().startswith("image/"):
raise HTTPException(status_code=415, detail="Content-ID is not an image")
target_dir = attachment_extract_dir(folder, uid)
filepath = _extract_attachment_to_disk(msg, idx, target_dir)
if not filepath:
raise HTTPException(status_code=404, detail="Inline image not found")
return FileResponse(
path=str(filepath),
media_type=ct,
headers={"Content-Disposition": f'inline; filename="{filepath.name}"'},
)
raise HTTPException(status_code=404, detail="Inline image not found")
except HTTPException:
raise
except Exception as e:
logger.error(f"Failed to load inline image {uid}/{want}: {e}")
return {"error": "Mail operation failed"}
@router.post("/attachment-as-doc/{uid}/{index}")
def attachment_as_doc(uid: str, index: int, request: Request, folder: str = Query("INBOX"), account_id: str | None = Query(None), owner: str = Depends(require_owner)):View on GitHub (pinned to f9235ebbf1)
Solutions
- Use a Content-ID that refers to an image part of the message.
- Check the MIME part type before requesting it as an image.
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/4e4ecef8e4d5bece.
Report an issue: GitHub.