{"record":{"id":"4f75b447b42d6178","repo":"BerriAI/litellm","slug":"error-syncing-policies-from-db-e","errorCode":null,"errorMessage":"Error syncing policies from DB: {e}","messagePattern":"Error syncing policies from DB: (.+?)","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"litellm/proxy/policy_engine/policy_registry.py","lineNumber":686,"sourceCode":"                            \"add\": row.guardrails_add or [],\n                            \"remove\": row.guardrails_remove or [],\n                        },\n                        \"condition\": row.condition,\n                        \"pipeline\": row.pipeline,\n                    },\n                )\n                self._policies_by_id[row.policy_id] = (row.policy_name, policy)\n\n            self._initialized = True\n            verbose_proxy_logger.info(\n                \"Synced %s production policies and %s draft/published (by ID) from DB to in-memory registry (%s config-defined policies preserved)\",\n                len(production),\n                len(non_production),\n                len(self._config_policies),\n            )\n        except Exception as e:\n            verbose_proxy_logger.exception(\"Error syncing policies from DB: %s\", e)\n            raise Exception(f\"Error syncing policies from DB: {e}\")\n\n    async def resolve_guardrails_from_db(\n        self,\n        policy_name: str,\n        prisma_client: \"PrismaClient\",\n    ) -> list[str]:\n        \"\"\"\n        Resolve all guardrails for a policy from the database.\n\n        Uses the existing PolicyResolver to handle inheritance chain resolution.\n\n        Args:\n            policy_name: Name of the policy to resolve\n            prisma_client: The Prisma client instance\n\n        Returns:\n            List of resolved guardrail names\n        \"\"\"","sourceCodeStart":668,"sourceCodeEnd":704,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/policy_registry.py#L668-L704","documentation":"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.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/policy_registry.py:686 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the database is reachable and migrated; restart the proxy to re-sync policies."],"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"}