{"record":{"id":"0a232b34bf0cbc71","repo":"BerriAI/litellm","slug":"budget-limits-entry-max-budget-non-finite-max-bu","errorCode":null,"errorMessage":"budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number.","messagePattern":"budget_limits entry max_budget \\((.+?)\\) must be a finite number\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":718,"sourceCode":"    user_api_key_dict: UserAPIKeyAuth,\n    is_ui_session_team_key: bool,\n    team_table: LiteLLM_TeamTableCachedObj | None,\n) -> None:\n    \"\"\"\n    Enforce three invariants on `budget_limits`:\n\n    - Every `budget_limits[*].max_budget` must be a finite number; applies\n      to every caller including proxy admin.\n    - A CLI session token caller may not set `budget_limits` on a personal\n      key (one with no `team_id`); mirrors the scalar `max_budget` guard in\n      `_common_key_generation_helper`.\n    - Non-admin callers may not set a window above their delegation ceiling.\n    \"\"\"\n    if not budget_limits:\n        return\n    non_finite: Final = next((w for w in budget_limits if not math.isfinite(w.max_budget)), None)\n    if non_finite is not None:\n        raise HTTPException(\n            status_code=400,\n            detail={\"error\": (f\"budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number.\")},\n        )\n    if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:\n        return\n    if is_ui_session_team_key:\n        return\n    if user_api_key_dict.is_session_token and team_table is None:\n        raise HTTPException(\n            status_code=400,\n            detail={\n                \"error\": (\"budget_limits cannot be set without specifying team_id when using a CLI session token.\")\n            },\n        )\n    if delegation_ceiling is None:\n        return\n    over_ceiling: Final = next((w for w in budget_limits if w.max_budget > delegation_ceiling), None)\n    if over_ceiling is not None:","sourceCodeStart":700,"sourceCodeEnd":736,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L700-L736","documentation":"Error \"budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:718 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set max_budget to a finite number (not NaN, inf, or -inf).","Validate the budget value client-side before sending the request."],"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"}