BerriAI/litellm · error · ValueError
sensitive_data_route_to_model must be set when on_sensitive_
Error message
sensitive_data_route_to_model must be set when on_sensitive_data='route'
What it means
Pydantic model_validator on guardrail params: on_sensitive_data was set to 'route' but sensitive_data_route_to_model was left unset, so the router has no destination model to send flagged requests to.
Source
Thrown at litellm/types/guardrails.py:962
"on_disallowed_action",
"unreachable_fallback",
"on_sensitive_data",
mode="before",
check_fields=False,
)
@classmethod
def normalize_lowercase(cls, v):
"""Normalize string and list fields to lowercase for ALL guardrail types."""
if isinstance(v, str):
return v.lower()
if isinstance(v, list):
return [x.lower() if isinstance(x, str) else x for x in v]
return v
@model_validator(mode="after")
def validate_sensitive_data_routing(self) -> "BaseLitellmParams":
if self.on_sensitive_data == "route" and not self.sensitive_data_route_to_model:
raise ValueError("sensitive_data_route_to_model must be set when on_sensitive_data='route'")
return self
model_config = ConfigDict(extra="allow", protected_namespaces=())
class Mode(BaseModel):
tags: dict[str, str | list[str]] = Field(description="Tags for the guardrail mode")
default: str | list[str] | None = Field(default=None, description="Default mode when no tags match")
class LitellmParams(
CiscoAIDefenseGuardrailConfigModel,
PresidioConfigModel,
BedrockGuardrailConfigModel,
LakeraV2GuardrailConfigModel,
HeadroomGuardrailConfigModel,
CompresrGuardrailConfigModel,
RepelloAIGuardrailConfigModel,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Set sensitive_data_route_to_model to the target model when on_sensitive_data='route'.
- Or change on_sensitive_data to 'block'/'mask' if routing is not needed.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/types/guardrails.py:962 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/fc282e887f758ea6.
Report an issue: GitHub.