BerriAI/litellm · error · HTTPException

budget_limits entry max_budget ({non_finite.max_budget}) mus

Error message

budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number.

What it means

Error "budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number." thrown in BerriAI/litellm.

Source

Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:718

    user_api_key_dict: UserAPIKeyAuth,
    is_ui_session_team_key: bool,
    team_table: LiteLLM_TeamTableCachedObj | None,
) -> None:
    """
    Enforce three invariants on `budget_limits`:

    - Every `budget_limits[*].max_budget` must be a finite number; applies
      to every caller including proxy admin.
    - A CLI session token caller may not set `budget_limits` on a personal
      key (one with no `team_id`); mirrors the scalar `max_budget` guard in
      `_common_key_generation_helper`.
    - Non-admin callers may not set a window above their delegation ceiling.
    """
    if not budget_limits:
        return
    non_finite: Final = next((w for w in budget_limits if not math.isfinite(w.max_budget)), None)
    if non_finite is not None:
        raise HTTPException(
            status_code=400,
            detail={"error": (f"budget_limits entry max_budget ({non_finite.max_budget}) must be a finite number.")},
        )
    if user_api_key_dict.user_role == LitellmUserRoles.PROXY_ADMIN.value:
        return
    if is_ui_session_team_key:
        return
    if user_api_key_dict.is_session_token and team_table is None:
        raise HTTPException(
            status_code=400,
            detail={
                "error": ("budget_limits cannot be set without specifying team_id when using a CLI session token.")
            },
        )
    if delegation_ceiling is None:
        return
    over_ceiling: Final = next((w for w in budget_limits if w.max_budget > delegation_ceiling), None)
    if over_ceiling is not None:

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Set max_budget to a finite number (not NaN, inf, or -inf).
  2. Validate the budget value client-side before sending the request.

When it happens

Trigger: Thrown at litellm/proxy/management_endpoints/key_management_endpoints.py:718 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/0a232b34bf0cbc71. Report an issue: GitHub.