{"record":{"id":"81a3de4eb651cd9b","repo":"BerriAI/litellm","slug":"reset-to-reset-to-must-be-current-spend-c","errorCode":null,"errorMessage":"reset_to ({reset_to}) must be <= current spend ({current_spend})","messagePattern":"reset_to \\((.+?)\\) must be <= current spend \\((.+?)\\)","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":5119,"sourceCode":"\ndef _validate_reset_spend_value(reset_to: object, key_in_db: LiteLLM_VerificationToken) -> float:\n    if not isinstance(reset_to, (int, float)):\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail={\"error\": \"reset_to must be a float\"},\n        )\n\n    reset_to = float(reset_to)\n\n    if reset_to < 0:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail={\"error\": \"reset_to must be >= 0\"},\n        )\n\n    current_spend: Final = key_in_db.spend or 0.0\n    if reset_to > current_spend:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail={\"error\": f\"reset_to ({reset_to}) must be <= current spend ({current_spend})\"},\n        )\n\n    max_budget = key_in_db.max_budget\n    if key_in_db.litellm_budget_table is not None:\n        budget_max_budget: Final = getattr(key_in_db.litellm_budget_table, \"max_budget\", None)\n        if budget_max_budget is not None:\n            if max_budget is None or budget_max_budget < max_budget:\n                max_budget = budget_max_budget\n\n    if max_budget is not None and reset_to > max_budget:\n        raise HTTPException(\n            status_code=status.HTTP_400_BAD_REQUEST,\n            detail={\"error\": f\"reset_to ({reset_to}) must be <= budget ({max_budget})\"},\n        )\n\n    return reset_to","sourceCodeStart":5101,"sourceCodeEnd":5137,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L5101-L5137","documentation":"Error \"reset_to ({reset_to}) must be <= current spend ({current_spend})\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:5119 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Choose a reset_to value less than or equal to the current spend.","Fetch current spend first to pick a valid reset target."],"exampleFix":null,"handlingStrategy":null,"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"}