{"record":{"id":"6a02de6297a0cbbc","repo":"odysseus-dev/odysseus","slug":"attachment-too-large","errorCode":null,"errorMessage":"Attachment too large","messagePattern":"Attachment too large","errorType":"http","errorClass":"HTTPException","httpStatus":413,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4048,"sourceCode":"            return {\n                \"success\": True,\n                \"token\": token,\n                \"filename\": safe_name,\n                \"size\": len(content),\n            }\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Failed to upload attachment: {e}\")\n            return {\"success\": False, \"error\": \"Mail operation failed\"}\n\n    def _safe_compose_filename(name: str, fallback: str = \"attachment\") -> str:\n        safe_name = re.sub(r\"[^\\w\\s\\-.]\", \"_\", Path(str(name or fallback)).name).strip(\". \")[:180]\n        return safe_name or fallback\n\n    def _stage_compose_bytes(filename: str, content: bytes) -> dict:\n        if len(content) > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:\n            raise HTTPException(status_code=413, detail=\"Attachment too large\")\n        safe_name = _safe_compose_filename(filename)\n        token = f\"{uuid.uuid4().hex}_{safe_name}\"\n        filepath = COMPOSE_UPLOADS_DIR / token\n        with open(filepath, \"wb\") as f:\n            f.write(content)\n        return {\"success\": True, \"token\": token, \"filename\": safe_name, \"size\": len(content)}\n\n    def _stage_compose_file(filename: str, src: Path) -> dict:\n        if not src.exists() or not src.is_file():\n            raise HTTPException(status_code=404, detail=\"File not found\")\n        size = src.stat().st_size\n        if size > EMAIL_COMPOSE_UPLOAD_MAX_BYTES:\n            raise HTTPException(status_code=413, detail=\"Attachment too large\")\n        safe_name = _safe_compose_filename(filename)\n        token = f\"{uuid.uuid4().hex}_{safe_name}\"\n        dest = COMPOSE_UPLOADS_DIR / token\n        import shutil as _shutil\n        _shutil.copyfile(str(src), str(dest))","sourceCodeStart":4030,"sourceCodeEnd":4066,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4030-L4066","documentation":"Error \"Attachment too large\" 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":["Download attachments individually instead of as an archive.","Ask the server administrator about raising the size limit, or fetch a smaller subset."],"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"}