{"record":{"id":"fb58d4ff637a6a6e","repo":"BerriAI/litellm","slug":"temp-budget-increase-and-temp-budget-expiry-must-b-fb58d4","errorCode":null,"errorMessage":"temp_budget_increase and temp_budget_expiry must be set together","messagePattern":"temp_budget_increase and temp_budget_expiry must be set together","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"litellm/types/proxy/management_endpoints/key_management_endpoints.py","lineNumber":82,"sourceCode":"    rpm_limit_type: Literal[\"guaranteed_throughput\", \"best_effort_throughput\", \"dynamic\"] | None = None\n    tpm_limit_type: Literal[\"guaranteed_throughput\", \"best_effort_throughput\", \"dynamic\"] | None = None\n\n    # Temporary budget grants (auto-expire). `spend` deliberately omitted — bulk-zeroing it bypasses budget enforcement; admin-only via /key/update.\n    temp_budget_increase: float | None = None\n    temp_budget_expiry: datetime | None = None\n\n    # Expiry\n    duration: str | None = None\n\n    # Operational metadata\n    tags: list[str] | None = None\n    metadata: dict[str, Any] | None = None\n\n    @model_validator(mode=\"after\")\n    def validate_temp_budget(self) -> \"KeyUpdateFields\":\n        if self.temp_budget_increase is not None or self.temp_budget_expiry is not None:\n            if self.temp_budget_increase is None or self.temp_budget_expiry is None:\n                raise ValueError(\"temp_budget_increase and temp_budget_expiry must be set together\")\n        return self\n\n    @model_validator(mode=\"after\")\n    def require_at_least_one_field(self) -> \"KeyUpdateFields\":\n        # Reject empty payload — would iterate every key with no-op writes.\n        if not self.model_fields_set:\n            raise ValueError(\"update_fields must specify at least one field to update.\")\n        return self\n\n\nclass BulkUpdateTeamKeysRequest(BaseModel):\n    \"\"\"Apply one update payload to many keys inside a team; provide either `key_ids` or `all_keys_in_team=True`.\"\"\"\n\n    team_id: str\n    key_ids: list[str] | None = None\n    all_keys_in_team: bool = False\n    update_fields: KeyUpdateFields\n","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/types/proxy/management_endpoints/key_management_endpoints.py#L64-L100","documentation":"Model validator on KeyUpdateFields: only one of temp_budget_increase / temp_budget_expiry was set. Temporary budget grants are a pair (amount plus when it expires), so specifying just one is rejected to prevent an unexpiring or amount-less grant.","triggerScenarios":"Thrown at litellm/types/proxy/management_endpoints/key_management_endpoints.py:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set both temp_budget_increase and temp_budget_expiry, or neither."],"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"}