{"record":{"id":"d304d678a2c5cf54","repo":"BerriAI/litellm","slug":"fallback-models-must-contain-at-least-one-model","errorCode":null,"errorMessage":"fallback_models must contain at least one model","messagePattern":"fallback_models must contain at least one model","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/types/management_endpoints/router_settings_endpoints.py","lineNumber":29,"sourceCode":"\nclass FallbackCreateRequest(BaseModel):\n    \"\"\"Request model for creating/updating fallbacks\"\"\"\n\n    model: str = Field(description=\"The model name to configure fallbacks for (e.g., 'gpt-3.5-turbo')\")\n    fallback_models: list[str] = Field(\n        description=\"List of fallback model names in order of priority\",\n        min_length=1,\n    )\n    fallback_type: Literal[\"general\", \"context_window\", \"content_policy\"] = Field(\n        default=\"general\",\n        description=\"Type of fallback: 'general' (default), 'context_window', or 'content_policy'\",\n    )\n\n    @field_validator(\"fallback_models\")\n    @classmethod\n    def validate_fallback_models(cls, v: list[str]) -> list[str]:\n        if not v:\n            raise ValueError(\"fallback_models must contain at least one model\")\n        if len(v) != len(set(v)):\n            raise ValueError(\"fallback_models must not contain duplicates\")\n        return v\n\n    @field_validator(\"model\")\n    @classmethod\n    def validate_model(cls, v: str) -> str:\n        if not v or not v.strip():\n            raise ValueError(\"model must be a non-empty string\")\n        return v.strip()\n\n\nclass FallbackResponse(BaseModel):\n    \"\"\"Response model for fallback operations\"\"\"\n\n    model: str = Field(description=\"The model name\")\n    fallback_models: list[str] = Field(description=\"List of fallback model names\")\n    fallback_type: str = Field(description=\"Type of fallback\")","sourceCodeStart":11,"sourceCodeEnd":47,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/types/management_endpoints/router_settings_endpoints.py#L11-L47","documentation":"Pydantic field_validator on FallbackCreateRequest.fallback_models: the list is empty after validation. A fallback configuration with zero fallback models is a no-op and is rejected (min_length is also enforced).","triggerScenarios":"Thrown at litellm/types/management_endpoints/router_settings_endpoints.py:29 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide at least one model name in fallback_models.","Remove the fallback_models setting if no fallbacks are desired."],"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-14T05:17:10.506Z"}