BerriAI/litellm · error · ValueError
Policy validation failed with {len(validation_result.errors)
Error message
Policy validation failed with {len(validation_result.errors)} error(s):
{error_messages} What it means
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.
Source
Thrown at litellm/proxy/policy_engine/init_policies.py:161
)
# Log validation results
if validation_result.errors:
for error in validation_result.errors:
verbose_proxy_logger.error(
"Policy validation error in '%s': [%s] %s", error.policy_name, error.error_type, error.message
)
if validation_result.warnings:
for warning in validation_result.warnings:
verbose_proxy_logger.warning(
"Policy validation warning in '%s': [%s] %s", warning.policy_name, warning.error_type, warning.message
)
# Fail if there are errors and fail_on_error is True
if not validation_result.valid and fail_on_error:
error_messages: Final = [f"[{e.policy_name}] {e.message}" for e in validation_result.errors]
raise ValueError(
f"Policy validation failed with {len(validation_result.errors)} error(s):\n" + "\n".join(error_messages)
)
# Load policies into registry (even with warnings)
try:
policy_registry.load_policies(policies_config)
verbose_proxy_logger.info("Successfully loaded %s policies", len(policies_config))
except Exception as e:
verbose_proxy_logger.error("Failed to load policies: %s", e)
raise
# Load attachments if provided
if policy_attachments_config:
try:
attachment_registry.load_attachments(policy_attachments_config)
verbose_proxy_logger.info("Successfully loaded %s policy attachments", len(policy_attachments_config))
except Exception as e:
verbose_proxy_logger.error("Failed to load policy attachments: %s", e)View on GitHub (pinned to 77b7c6c40c)
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.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/policy_engine/init_policies.py:161 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/cbcf57a65d4bc639.
Report an issue: GitHub.