{"record":{"id":"7f5b9fe2c7a85d1b","repo":"BerriAI/litellm","slug":"invalid-mode-v-must-be-one-of-sorted-valid","errorCode":null,"errorMessage":"Invalid mode '{v}'. Must be one of: {sorted(VALID_PIPELINE_MODES)}","messagePattern":"Invalid mode '(.+?)'\\. Must be one of: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/types/proxy/policy_engine/pipeline_types.py","lineNumber":80,"sourceCode":"    Defines ordered execution of guardrails with conditional actions.\n\n    When present on a policy, the guardrails in `steps` are executed\n    sequentially instead of independently.\n    \"\"\"\n\n    mode: str = Field(description=\"Event hook: pre_call | post_call\")\n    steps: list[PipelineStep] = Field(\n        description=\"Ordered list of pipeline steps. Must have at least 1 step.\",\n        min_length=1,\n    )\n\n    model_config = ConfigDict(extra=\"forbid\")\n\n    @field_validator(\"mode\")\n    @classmethod\n    def validate_mode(cls, v: str) -> str:\n        if v not in VALID_PIPELINE_MODES:\n            raise ValueError(f\"Invalid mode '{v}'. Must be one of: {sorted(VALID_PIPELINE_MODES)}\")\n        return v\n\n\nclass PipelineStepResult(BaseModel):\n    \"\"\"Result of executing a single pipeline step.\"\"\"\n\n    guardrail_name: str\n    outcome: Literal[\"pass\", \"fail\", \"error\"]\n    action_taken: str\n    modified_data: dict[str, Any] | None = None\n    error_detail: str | None = None\n    duration_seconds: float | None = None\n\n\nclass PipelineExecutionResult(BaseModel):\n    \"\"\"Result of executing an entire pipeline.\"\"\"\n\n    model_config = ConfigDict(arbitrary_types_allowed=True)","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/types/proxy/policy_engine/pipeline_types.py#L62-L98","documentation":"Pydantic validator on PipelineDefinition.mode: the mode string is not one of VALID_PIPELINE_MODES (pre_call / post_call hooks). The guardrail pipeline only knows how to attach to those hooks, so an unknown mode is rejected at policy parse time.","triggerScenarios":"Thrown at litellm/types/proxy/policy_engine/pipeline_types.py:80 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use one of the valid pipeline modes listed in the error: {sorted(VALID_PIPELINE_MODES)}."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}