BerriAI/litellm · error · Exception
Error getting policies from DB: {e}
Error message
Error getting policies from DB: {e} What it means
Catch-all from the policy list routine: the find_many query on the policy table (optionally filtered by version_status) or row conversion raised; the underlying exception text is included, pointing at a database-level failure.
Source
Thrown at litellm/proxy/policy_engine/policy_registry.py:615
("draft", "published", "production").
Returns:
List of PolicyDBResponse objects
"""
try:
where: Final[dict[str, str]] = {}
if version_status is not None:
where["version_status"] = version_status
policies: Final = await _policy_table(prisma_client).find_many(
where=where if where else None,
order={"created_at": "desc"},
)
return [_row_to_policy_db_response(p) for p in policies]
except Exception as e:
verbose_proxy_logger.exception("Error getting policies from DB: %s", e)
raise Exception(f"Error getting policies from DB: {e}")
async def sync_policies_from_db(
self,
prisma_client: "PrismaClient",
) -> None:
"""
Sync policies from the database to in-memory registry.
- Production versions are loaded into _policies (by policy name) for resolution.
- Config-loaded policies are preserved; on a name conflict the DB version wins.
- Draft and published versions are loaded into _policies_by_id so request-body
policy_<uuid> overrides can be resolved without DB access in the hot path.
"""
try:
production: Final = await self.get_all_policies_from_db(prisma_client, version_status="production")
db_policies: Final = {
policy_response.policy_name: self._parse_policy(
policy_response.policy_name,
{View on GitHub (pinned to 77b7c6c40c)
Solutions
- Check DB connectivity and logs for the underlying error, then retry the list request.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:615 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/71fb06c6da5f3c4b.
Report an issue: GitHub.