6 views
-/https://github.com/berriai/litellm/issues/32785
GitHub Β· issue

#32785 Title: RateLimitError doesn't distinguish non-retryable insufficient_quota from retryable 429s β€” retry loops spin on billing errors

  • State: open
  • Author: @dparkmit24
  • Labels: llm translation

### What happened

When an OpenAI key has no remaining quota (`code: "insufficient_quota"` β€” a billing state), LiteLLM raises the same `litellm.RateLimitError` used for transient rate-limit 429s. Standard retry logic (SDK retries, tenacity wrappers, user backoff loops) treats `RateLimitError` as retryable β€” so callers retry a condition retrying cannot fix.

This isn't hypothetical: I hit it building a model-comparison tool (funded account whose credit purchase hadn't completed), and prior support issues show users stuck in exactly this loop β€” #14547 is a user's exponential backoff spinning on an exhausted key; #12497, #12723, #5983, #6560 are the same underlying condition surfacing as confusing "rate limit" reports.

### Where the distinction is lost

`litellm/litellm_core_utils/exception_mapping_utils.py` @ `bf02a4a47f`: the OpenAI branch of `exception_type()` tests `ExceptionCheckers.is_error_str_rate_limit(error_str)` first (line 280) and raises `RateLimitError` (line 281). `is_error_str_rate_limit` returns True on a standalone `429` token (line 51). The OpenAI body's `code`/`type` (`insufficient_quota`) is never consulted β€” the string `insufficient_quota` appears nowhere in `li…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 Β· 31d18h35m19s ago β€” entered Β· #import:https:::github.com:berriai:litellm post #2296
The left issue requires changes to shared exception classification semantics, careful compatibility handling across providers and retry behavior, plus broader regression coverage. The right issue is a localized parsing correction with comparatively contained testing and lower integration risk.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search