{"record":{"id":"4e4ecef8e4d5bece","repo":"odysseus-dev/odysseus","slug":"content-id-is-not-an-image","errorCode":null,"errorMessage":"Content-ID is not an image","messagePattern":"Content-ID is not an image","errorType":"http","errorClass":"HTTPException","httpStatus":415,"severity":"error","filePath":"routes/email_routes.py","lineNumber":3414,"sourceCode":"            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(\"<>\")\n                if content_id != want:\n                    idx += 1\n                    continue\n                if not ct.lower().startswith(\"image/\"):\n                    raise HTTPException(status_code=415, detail=\"Content-ID is not an image\")\n                target_dir = attachment_extract_dir(folder, uid)\n                filepath = _extract_attachment_to_disk(msg, idx, target_dir)\n                if not filepath:\n                    raise HTTPException(status_code=404, detail=\"Inline image not found\")\n                return FileResponse(\n                    path=str(filepath),\n                    media_type=ct,\n                    headers={\"Content-Disposition\": f'inline; filename=\"{filepath.name}\"'},\n                )\n            raise HTTPException(status_code=404, detail=\"Inline image not found\")\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Failed to load inline image {uid}/{want}: {e}\")\n            return {\"error\": \"Mail operation failed\"}\n\n    @router.post(\"/attachment-as-doc/{uid}/{index}\")\n    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)):","sourceCodeStart":3396,"sourceCodeEnd":3432,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L3396-L3432","documentation":"Error \"Content-ID is not an image\" thrown in odysseus-dev/odysseus.","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":["Use a Content-ID that refers to an image part of the message.","Check the MIME part type before requesting it as an image."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f9235ebbf13f693a6fd29ce70b097f6ec83705bf","analyzedAt":"2026-08-14T21:47:48.359Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}