BerriAI/litellm · error · HTTPException
guardrail_pipeline_error
guardrail_pipeline_error
Error message
Content blocked by guardrail pipeline '{policy_name}' What it means
Policy-enforcement error raised when a guardrail pipeline's step results include a blocking outcome: at least one guardrail in the named policy flagged the content and its action stopped the call. The error body embeds the policy name and per-step outcomes so callers can see which guardrail fired; this is intended content moderation, not a system fault.
Source
Thrown at litellm/proxy/utils.py:1350
step_results_serializable: Final = [
{
"guardrail": sr.guardrail_name,
"outcome": sr.outcome,
"action": sr.action_taken,
}
for sr in result.step_results
]
error_detail: Final = {
"error": {
"message": f"Content blocked by guardrail pipeline '{policy_name}'",
"type": "guardrail_pipeline_error",
"pipeline_context": {
"policy": policy_name,
"step_results": step_results_serializable,
},
}
}
raise HTTPException(status_code=400, detail=error_detail)
if result.terminal_action == "modify_response":
raise ModifyResponseException(
message=result.modify_response_message or "Response modified by pipeline",
model=data.get("model", "unknown"),
request_data=data,
guardrail_name=f"pipeline:{policy_name}",
detection_info=None,
)
return data
# The actual implementation of the function
@overload
async def pre_call_hook(
self,
user_api_key_dict: UserAPIKeyAuth,
data: None,View on GitHub (pinned to 77b7c6c40c)
Solutions
- Modify the request content so it passes the guardrail policy, or adjust the policy configuration if it is a false positive.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at litellm/proxy/utils.py:1350 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/69c849d3d0ba7cd3.
Report an issue: GitHub.