BerriAI/litellm · error · Exception

Error deleting all versions: {e}

Error message

Error deleting all versions: {e}

What it means

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.

Source

Thrown at litellm/proxy/policy_engine/policy_registry.py:1044

        Returns:
            Dict with "message" and optional "warning" if a config-defined policy took over.
        """
        try:
            await _policy_table(prisma_client).delete_many(where={"policy_name": policy_name})
            self.remove_policy(policy_name)
            message: Final = f"All versions of policy '{policy_name}' deleted successfully"
            if self.get_source(policy_name) == "config":
                return {
                    "message": message,
                    "warning": (
                        "All DB versions were deleted. The config-defined policy with the same name is active again."
                    ),
                }
            return {"message": message}
        except Exception as e:
            verbose_proxy_logger.exception("Error deleting all versions: %s", e)
            raise Exception(f"Error deleting all versions: {e}")


# Global singleton instance
_policy_registry: PolicyRegistry | None = None


def get_policy_registry() -> PolicyRegistry:
    """
    Get the global PolicyRegistry singleton.

    Returns:
        The global PolicyRegistry instance
    """
    global _policy_registry
    if _policy_registry is None:
        _policy_registry = PolicyRegistry()
    return _policy_registry

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Check DB connectivity and logs; remove blocking references and retry the delete.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:1044 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/18a71fab26dd0f99. Report an issue: GitHub.