{"record":{"id":"35c84b4e2c55e5b1","repo":"BerriAI/litellm","slug":"error-getting-attachment-from-db-e","errorCode":null,"errorMessage":"Error getting attachment from DB: {e}","messagePattern":"Error getting attachment from DB: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":500,"severity":"error","filePath":"litellm/proxy/policy_engine/attachment_registry.py","lineNumber":411,"sourceCode":"            if attachment is None:\n                return None\n\n            return PolicyAttachmentDBResponse(\n                attachment_id=attachment.attachment_id,\n                policy_name=attachment.policy_name,\n                scope=attachment.scope,\n                teams=attachment.teams or [],\n                keys=attachment.keys or [],\n                models=attachment.models or [],\n                tags=attachment.tags or [],\n                created_at=attachment.created_at,\n                updated_at=attachment.updated_at,\n                created_by=attachment.created_by,\n                updated_by=attachment.updated_by,\n            )\n        except Exception as e:\n            verbose_proxy_logger.exception(\"Error getting attachment from DB: %s\", e)\n            raise Exception(f\"Error getting attachment from DB: {e}\")\n\n    async def get_all_attachments_from_db(\n        self,\n        prisma_client: \"PrismaClient\",\n    ) -> list[PolicyAttachmentDBResponse]:\n        \"\"\"\n        Get all policy attachments from the database.\n\n        Args:\n            prisma_client: The Prisma client instance\n\n        Returns:\n            List of PolicyAttachmentDBResponse objects\n        \"\"\"\n        try:\n            attachments: Final[Sequence[LiteLLM_PolicyAttachmentTable]] = await PolicyAttachmentRepository(\n                prisma_client\n            ).table.find_many(","sourceCodeStart":393,"sourceCodeEnd":429,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/attachment_registry.py#L393-L429","documentation":"DB error wrapper in the policy attachment registry: fetching a single attachment by ID from Prisma raised; the exception is logged and re-raised with this prefix so callers see it as a registry DB failure.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/attachment_registry.py:411 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check database connectivity and logs; verify the attachment ID exists, then retry."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}