{"record":{"id":"02bf675624a0b409","repo":"BerriAI/litellm","slug":"reset-to-must-be-0","errorCode":null,"errorMessage":"reset_to must be >= 0","messagePattern":"reset_to must be >= 0","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":5112,"sourceCode":"                return\n\n    raise HTTPException(\n        status_code=status.HTTP_403_FORBIDDEN,\n        detail={\"error\": \"You must be a proxy admin or team admin to reset key spend\"},\n    )\n\n\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","sourceCodeStart":5094,"sourceCodeEnd":5130,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L5094-L5130","documentation":"Error \"reset_to must be >= 0\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:5112 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a reset_to value of 0 or greater.","Use 0 to fully reset the key's spend."],"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"}