{"record":{"id":"a63f7b278a84f679","repo":"BerriAI/litellm","slug":"budget-limits-cannot-be-set-without-specifying-tea","errorCode":null,"errorMessage":"budget_limits cannot be set without specifying team_id when using a CLI session token.","messagePattern":"budget_limits cannot be set without specifying team_id when using a CLI session token\\.","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"error","filePath":"litellm/proxy/management_endpoints/key_management_endpoints.py","lineNumber":727,"sourceCode":"    - 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:\n        raise HTTPException(\n            status_code=400,\n            detail={\n                \"error\": (\n                    f\"budget_limits entry max_budget ({over_ceiling.max_budget}) \"\n                    f\"cannot exceed the caller's own max_budget ({delegation_ceiling}).\"\n                )\n            },\n        )","sourceCodeStart":709,"sourceCodeEnd":745,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/proxy/management_endpoints/key_management_endpoints.py#L709-L745","documentation":"Error \"budget_limits cannot be set without specifying team_id when using a CLI session token.\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:727 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Include team_id in the request when setting budget_limits with a CLI session token.","Use a regular virtual key instead of a CLI session token to set budget_limits without a team."],"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"}