{"record":{"id":"40a2b4c6570bff23","repo":"odysseus-dev/odysseus","slug":"missing-image-content-id","errorCode":null,"errorMessage":"Missing image Content-ID","messagePattern":"Missing image Content-ID","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/email_routes.py","lineNumber":3391,"sourceCode":"            )\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Failed to download attachments zip {uid}: {e}\")\n            raise HTTPException(status_code=500, detail=\"Mail operation failed\")\n\n    @router.get(\"/inline-image/{uid}\")\n    async def inline_image(\n        uid: str,\n        cid: str = Query(...),\n        folder: str = Query(\"INBOX\"),\n        account_id: str | None = Query(None),\n        owner: str = Depends(require_owner),\n    ):\n        \"\"\"Serve an inline MIME image by Content-ID after the user explicitly clicks Load.\"\"\"\n        want = (cid or \"\").strip().strip(\"<>\")\n        if not want:\n            raise HTTPException(status_code=400, detail=\"Missing image Content-ID\")\n        try:\n            with _imap(account_id, owner=owner) as conn:\n                conn.select(_q(folder), readonly=True)\n                status, msg_data = _imap_uid_fetch(conn, uid, \"(RFC822)\")\n            if status != \"OK\":\n                raise HTTPException(status_code=404, detail=\"Email not found\")\n            raw = msg_data[0][1]\n            msg = email_mod.message_from_bytes(raw)\n            idx = 0\n            for part in msg.walk():\n                cd = str(part.get(\"Content-Disposition\", \"\"))\n                ct = part.get_content_type()\n                is_attached_email = ct == \"message/rfc822\" and (\"attachment\" in cd.lower() or part.get_filename())\n                if part.is_multipart() and not is_attached_email:\n                    continue\n                if ct in (\"text/plain\", \"text/html\") and \"attachment\" not in cd:\n                    continue\n                content_id = (part.get(\"Content-ID\") or \"\").strip().strip(\"<>\")","sourceCodeStart":3373,"sourceCodeEnd":3409,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L3373-L3409","documentation":"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.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":["Pass the Content-ID of the inline image in the request.","Inspect the email HTML for the cid: reference and use that identifier."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","contentChangedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}