{"record":{"id":"1f9bb50abe85c206","repo":"odysseus-dev/odysseus","slug":"too-many-attachments","errorCode":null,"errorMessage":"Too many attachments","messagePattern":"Too many attachments","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"routes/email_routes.py","lineNumber":4146,"sourceCode":"                if \"path\" in src:\n                    return _stage_compose_file(src[\"filename\"], src[\"path\"])\n                return _stage_compose_bytes(src[\"filename\"], src[\"content\"])\n            finally:\n                db.close()\n        except HTTPException:\n            raise\n        except Exception as e:\n            logger.error(f\"Failed to stage Odysseus attachment {kind}/{item_id}: {e}\")\n            return {\"success\": False, \"error\": \"Mail operation failed\"}\n\n    @router.post(\"/compose-from-odysseus-zip\")\n    async def compose_from_odysseus_zip(data: dict, owner: str = Depends(require_owner)):\n        \"\"\"Stage several Odysseus documents/gallery images as one zip attachment.\"\"\"\n        raw_items = data.get(\"items\") or []\n        if not isinstance(raw_items, list) or not raw_items:\n            raise HTTPException(status_code=400, detail=\"Expected items\")\n        if len(raw_items) > 100:\n            raise HTTPException(status_code=400, detail=\"Too many attachments\")\n        try:\n            from core.database import SessionLocal as _SL\n\n            db = _SL()\n            try:\n                buf = io.BytesIO()\n                used_names: dict[str, int] = {}\n\n                def unique_name(name: str) -> str:\n                    safe = _safe_attachment_zip_name(name, \"attachment\")\n                    stem = Path(safe).stem or \"attachment\"\n                    suffix = Path(safe).suffix\n                    idx = used_names.get(safe, 0)\n                    used_names[safe] = idx + 1\n                    if idx == 0:\n                        return safe\n                    return f\"{stem}-{idx + 1}{suffix}\"\n","sourceCodeStart":4128,"sourceCodeEnd":4164,"githubUrl":"https://github.com/odysseus-dev/odysseus/blob/f9235ebbf13f693a6fd29ce70b097f6ec83705bf/routes/email_routes.py#L4128-L4164","documentation":"Error \"Too many attachments\" 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":["Reduce the number of attachments and send multiple messages instead.","Compress or link large sets of files rather than attaching them all."],"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"}