{"record":{"id":"cbcf57a65d4bc639","repo":"BerriAI/litellm","slug":"policy-validation-failed-with-len-validation-resu","errorCode":null,"errorMessage":"Policy validation failed with {len(validation_result.errors)} error(s):\n{error_messages}","messagePattern":"Policy validation failed with (.+?) error\\(s\\):\n(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/policy_engine/init_policies.py","lineNumber":161,"sourceCode":"    )\n\n    # Log validation results\n    if validation_result.errors:\n        for error in validation_result.errors:\n            verbose_proxy_logger.error(\n                \"Policy validation error in '%s': [%s] %s\", error.policy_name, error.error_type, error.message\n            )\n\n    if validation_result.warnings:\n        for warning in validation_result.warnings:\n            verbose_proxy_logger.warning(\n                \"Policy validation warning in '%s': [%s] %s\", warning.policy_name, warning.error_type, warning.message\n            )\n\n    # Fail if there are errors and fail_on_error is True\n    if not validation_result.valid and fail_on_error:\n        error_messages: Final = [f\"[{e.policy_name}] {e.message}\" for e in validation_result.errors]\n        raise ValueError(\n            f\"Policy validation failed with {len(validation_result.errors)} error(s):\\n\" + \"\\n\".join(error_messages)\n        )\n\n    # Load policies into registry (even with warnings)\n    try:\n        policy_registry.load_policies(policies_config)\n        verbose_proxy_logger.info(\"Successfully loaded %s policies\", len(policies_config))\n    except Exception as e:\n        verbose_proxy_logger.error(\"Failed to load policies: %s\", e)\n        raise\n\n    # Load attachments if provided\n    if policy_attachments_config:\n        try:\n            attachment_registry.load_attachments(policy_attachments_config)\n            verbose_proxy_logger.info(\"Successfully loaded %s policy attachments\", len(policy_attachments_config))\n        except Exception as e:\n            verbose_proxy_logger.error(\"Failed to load policy attachments: %s\", e)","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/policy_engine/init_policies.py#L143-L179","documentation":"Startup failure in init_policies when policy validation produced errors and fail_on_error is set: the aggregated per-policy validation messages are raised so the proxy refuses to start with an invalid policy configuration.","triggerScenarios":"Thrown at litellm/proxy/policy_engine/init_policies.py:161 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix each listed policy validation error in the policy definition (schema, pipeline steps, referenced guardrails).","Validate the policy against the policy schema before submitting."],"exampleFix":null,"handlingStrategy":"validation","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-14T05:17:10.506Z"}