{"record":{"id":"18a71fab26dd0f99","repo":"BerriAI/litellm","slug":"error-deleting-all-versions-e","errorCode":null,"errorMessage":"Error deleting all versions: {e}","messagePattern":"Error deleting all versions: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/policy_engine/policy_registry.py","lineNumber":1044,"sourceCode":"\n        Returns:\n            Dict with \"message\" and optional \"warning\" if a config-defined policy took over.\n        \"\"\"\n        try:\n            await _policy_table(prisma_client).delete_many(where={\"policy_name\": policy_name})\n            self.remove_policy(policy_name)\n            message: Final = f\"All versions of policy '{policy_name}' deleted successfully\"\n            if self.get_source(policy_name) == \"config\":\n                return {\n                    \"message\": message,\n                    \"warning\": (\n                        \"All DB versions were deleted. The config-defined policy with the same name is active again.\"\n                    ),\n                }\n            return {\"message\": message}\n        except Exception as e:\n            verbose_proxy_logger.exception(\"Error deleting all versions: %s\", e)\n            raise Exception(f\"Error deleting all versions: {e}\")\n\n\n# Global singleton instance\n_policy_registry: PolicyRegistry | None = None\n\n\ndef get_policy_registry() -> PolicyRegistry:\n    \"\"\"\n    Get the global PolicyRegistry singleton.\n\n    Returns:\n        The global PolicyRegistry instance\n    \"\"\"\n    global _policy_registry\n    if _policy_registry is None:\n        _policy_registry = PolicyRegistry()\n    return _policy_registry\n","sourceCodeStart":1026,"sourceCodeEnd":1062,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/policy_registry.py#L1026-L1062","documentation":"Catch-all from the delete-all-versions routine: the Prisma delete_many on all rows for the policy name, or the subsequent in-memory registry removal, failed; the original error is embedded. Config-takeover warnings are lost when this raises.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/policy_registry.py:1044 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check DB connectivity and logs; remove blocking references and retry the delete."],"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"}