BerriAI/litellm · error · ModifyResponseException

Response modified by pipeline

Error message

Response modified by pipeline

What it means

Sentinel error meaning a guardrail pipeline step transformed the response (e.g. masked or redacted content) rather than blocking it. Unlike the blocked-content error, the request succeeded; the body/error signals that the returned content was modified by the policy named in pipeline_context.

Source

Thrown at litellm/proxy/utils.py:1353

                    "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,
        call_type: CallTypesLiteral,
    ) -> None:
        pass

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The response was altered by a guardrail/pipeline policy; review the pipeline configuration or accept the modified response.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/utils.py:1353 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/182555993e691a34. Report an issue: GitHub.