{"record":{"id":"043106db3edde73c","repo":"BerriAI/litellm","slug":"error-syncing-attachments-from-db-e","errorCode":null,"errorMessage":"Error syncing attachments from DB: {e}","messagePattern":"Error syncing attachments from DB: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":500,"severity":"error","filePath":"litellm/proxy/policy_engine/attachment_registry.py","lineNumber":488,"sourceCode":"                    scope=attachment_response.scope,\n                    teams=(attachment_response.teams if attachment_response.teams else None),\n                    keys=attachment_response.keys if attachment_response.keys else None,\n                    models=(attachment_response.models if attachment_response.models else None),\n                    tags=attachment_response.tags if attachment_response.tags else None,\n                )\n                for attachment_response in attachments\n            ]\n            self._attachments = [*self._config_attachments, *db_attachments]\n\n            self._initialized = True\n            verbose_proxy_logger.info(\n                \"Synced %s attachments from DB to in-memory registry (%s config-defined attachments preserved)\",\n                len(attachments),\n                len(self._config_attachments),\n            )\n        except Exception as e:\n            verbose_proxy_logger.exception(\"Error syncing attachments from DB: %s\", e)\n            raise Exception(f\"Error syncing attachments from DB: {e}\")\n\n\n# Global singleton instance\n_attachment_registry: AttachmentRegistry | None = None\n\n\ndef get_attachment_registry() -> AttachmentRegistry:\n    \"\"\"\n    Get the global AttachmentRegistry singleton.\n\n    Returns:\n        The global AttachmentRegistry instance\n    \"\"\"\n    global _attachment_registry\n    if _attachment_registry is None:\n        _attachment_registry = AttachmentRegistry()\n    return _attachment_registry\n","sourceCodeStart":470,"sourceCodeEnd":506,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/attachment_registry.py#L470-L506","documentation":"Catch-all raised while rebuilding the in-memory attachment registry from DB rows: reading PolicyAttachment records or converting them to in-memory attachment objects failed, so the sync between database and in-memory state aborted; the original error is embedded.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/attachment_registry.py:488 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the database is reachable and migrated; restart the proxy to re-run attachment sync."],"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-14T05:17:10.506Z"}