BerriAI/litellm · error · Exception
Error syncing policies from DB: {e}
Error message
Error syncing policies from DB: {e} What it means
DB error wrapper in the policy registry: the startup sync that loads production and draft policies from the DB into the in-memory registry raised; the exception is logged and re-raised with this prefix.
Source
Thrown at litellm/proxy/policy_engine/policy_registry.py:686
"add": row.guardrails_add or [],
"remove": row.guardrails_remove or [],
},
"condition": row.condition,
"pipeline": row.pipeline,
},
)
self._policies_by_id[row.policy_id] = (row.policy_name, policy)
self._initialized = True
verbose_proxy_logger.info(
"Synced %s production policies and %s draft/published (by ID) from DB to in-memory registry (%s config-defined policies preserved)",
len(production),
len(non_production),
len(self._config_policies),
)
except Exception as e:
verbose_proxy_logger.exception("Error syncing policies from DB: %s", e)
raise Exception(f"Error syncing policies from DB: {e}")
async def resolve_guardrails_from_db(
self,
policy_name: str,
prisma_client: "PrismaClient",
) -> list[str]:
"""
Resolve all guardrails for a policy from the database.
Uses the existing PolicyResolver to handle inheritance chain resolution.
Args:
policy_name: Name of the policy to resolve
prisma_client: The Prisma client instance
Returns:
List of resolved guardrail names
"""View on GitHub (pinned to 77b7c6c40c)
Solutions
- Ensure the database is reachable and migrated; restart the proxy to re-sync policies.
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/policy_registry.py:686 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/4f75b447b42d6178.
Report an issue: GitHub.