{"record":{"id":"ad03805854d18294","repo":"BerriAI/litellm","slug":"at-least-one-of-keys-or-key-aliases-must-be-pr","errorCode":null,"errorMessage":"At least one of 'keys' or 'key_aliases' must be provided.","messagePattern":"At least one of 'keys' or 'key_aliases' must be provided\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/proxy/_types.py","lineNumber":1269,"sourceCode":"    spend: float | None = None\n    metadata: dict | None = None\n    new_master_key: str | None = None\n    grace_period: str | None = None  # Duration to keep old key valid (e.g. \"24h\", \"2d\"); None = immediate revoke\n\n\nclass ResetSpendRequest(LiteLLMPydanticObjectBase):\n    reset_to: float\n\n\nclass KeyRequest(LiteLLMPydanticObjectBase):\n    keys: list[str] | None = None\n    key_aliases: list[str] | None = None\n\n    @model_validator(mode=\"before\")\n    @classmethod\n    def validate_at_least_one(cls, values):\n        if not values.get(\"keys\") and not values.get(\"key_aliases\"):\n            raise ValueError(\"At least one of 'keys' or 'key_aliases' must be provided.\")\n        return values\n\n\nfrom litellm.models.model import (  # noqa: E402\n    LiteLLM_ProxyModelTable as LiteLLM_ProxyModelTable,\n)\nfrom litellm.models.team import LiteLLM_ModelTable as LiteLLM_ModelTable  # noqa: E402\n\n\n# MCP Types\nclass SpecialMCPServerName(str, enum.Enum):\n    all_team_servers = \"all-team-mcpservers\"\n    all_proxy_servers = \"all-proxy-mcpservers\"\n\n\nclass MCPApprovalStatus(str, enum.Enum):\n    pending_review = \"pending_review\"\n    active = \"active\"","sourceCodeStart":1251,"sourceCodeEnd":1287,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/_types.py#L1251-L1287","documentation":"Pydantic model_validator (validate_at_least_one) on KeyRequest rejecting a bulk request whose 'keys' and 'key_aliases' are both empty/None. Endpoints consuming this model operate on existing keys in bulk (delete/rotate/etc.), so a request naming zero keys is rejected up front instead of being treated as a no-op success.","triggerScenarios":"Thrown at litellm/proxy/_types.py:1269 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide at least one of 'keys' or 'key_aliases'."],"exampleFix":"keys=['sk-...']","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"}