BerriAI/litellm · error · Exception
Error deleting policy from DB: {e}
Error message
Error deleting policy from DB: {e} What it means
Catch-all from the policy delete routine: the Prisma delete of the policy row (or the follow-up in-memory registry maintenance) raised; the original error text is included. Any produced warnings about config-defined takeover are lost when this raises.
Source
Thrown at litellm/proxy/policy_engine/policy_registry.py:542
result: Final[dict[str, str]] = {"message": f"Policy {policy_id} deleted successfully"}
# Remove from in-memory registry only if this was the production version
if version_status == "production":
self.remove_policy(policy_name)
if self.get_source(policy_name) == "config":
result["warning"] = (
"Production version was deleted. The config-defined policy with the same name is active again."
)
else:
result["warning"] = (
"Production version was deleted. No other version was promoted. "
"Promote another version to production if this policy should remain active."
)
return result
except Exception as e:
verbose_proxy_logger.exception("Error deleting policy from DB: %s", e)
raise Exception(f"Error deleting policy from DB: {e}")
async def get_policy_by_id_from_db(
self,
policy_id: str,
prisma_client: "PrismaClient",
) -> PolicyDBResponse | None:
"""
Get a policy by ID from the database.
Args:
policy_id: The ID of the policy to retrieve
prisma_client: The Prisma client instance
Returns:
PolicyDBResponse if found, None otherwise
"""
try:
policy: Final = await _policy_table(prisma_client).find_unique(where={"policy_id": policy_id})View on GitHub (pinned to 77b7c6c40c)
Solutions
- Check DB connectivity and logs; ensure no references block deletion, then retry.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:542 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/fca37eb554a71144.
Report an issue: GitHub.