BerriAI/litellm · error · ValueError

Invalid action '{v}'. Must be one of: {sorted(VALID_PIPELINE

Error message

Invalid action '{v}'. Must be one of: {sorted(VALID_PIPELINE_ACTIONS)}

What it means

Pydantic field_validator on PipelineStep transition fields (on_fail/on_pass/on_error): the given action string is not in VALID_PIPELINE_ACTIONS, so the policy engine would not know how to proceed after that step outcome.

Source

Thrown at litellm/types/proxy/policy_engine/pipeline_types.py:56

    )
    pass_data: bool = Field(
        default=False,
        description="Forward modified request data (e.g., PII-masked) to next step.",
    )
    modify_response_message: str | None = Field(
        default=None,
        description="Custom message for modify_response action.",
    )

    model_config = ConfigDict(extra="forbid")

    @field_validator("on_fail", "on_pass", "on_error")
    @classmethod
    def validate_action(cls, v: str | None) -> str | None:
        if v is None:
            return None
        if v not in VALID_PIPELINE_ACTIONS:
            raise ValueError(f"Invalid action '{v}'. Must be one of: {sorted(VALID_PIPELINE_ACTIONS)}")
        return v


class GuardrailPipeline(BaseModel):
    """
    Defines ordered execution of guardrails with conditional actions.

    When present on a policy, the guardrails in `steps` are executed
    sequentially instead of independently.
    """

    mode: str = Field(description="Event hook: pre_call | post_call")
    steps: list[PipelineStep] = Field(
        description="Ordered list of pipeline steps. Must have at least 1 step.",
        min_length=1,
    )

    model_config = ConfigDict(extra="forbid")

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Use one of the valid pipeline actions listed in the error: {sorted(VALID_PIPELINE_ACTIONS)}.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/types/proxy/policy_engine/pipeline_types.py:56 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/2c6bb14338b952e9. Report an issue: GitHub.