BerriAI/litellm · error · RateLimitError

RateLimitError: {exception_provider} - {message}

Error message

RateLimitError: {exception_provider} - {message}

What it means

Exception-mapping branch: when the provider error string/status indicates a rate limit, the original provider exception is re-raised as a litellm RateLimitError with the provider name and original message embedded, normalizing 429-style errors across providers.

Source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:291

            message = str(original_exception)

    if message is not None and isinstance(
        message, str
    ):  # done to prevent user-confusion. Relevant issue - https://github.com/BerriAI/litellm/issues/1414
        message = message.replace("OPENAI", custom_llm_provider.upper())
        message = message.replace(
            "openai.OpenAIError",
            f"{custom_llm_provider}.{custom_llm_provider}Error",
        )
    if custom_llm_provider == "openai":
        exception_provider = "OpenAI" + "Exception"
    else:
        exception_provider = custom_llm_provider[0].upper() + custom_llm_provider[1:] + "Exception"

    if ExceptionCheckers.is_error_str_rate_limit(
        error_str, status_code=getattr(original_exception, "status_code", None)
    ):
        raise RateLimitError(
            message=f"RateLimitError: {exception_provider} - {message}",
            model=model,
            llm_provider=custom_llm_provider,
            response=getattr(original_exception, "response", None),
        )
    elif ExceptionCheckers.is_error_str_context_window_exceeded(error_str):
        raise ContextWindowExceededError(
            message=f"ContextWindowExceededError: {exception_provider} - {message}",
            llm_provider=custom_llm_provider,
            model=model,
            response=getattr(original_exception, "response", None),
            litellm_debug_info=extra_information,
        )
    elif "invalid_request_error" in error_str and "model_not_found" in error_str:
        raise NotFoundError(
            message=f"{exception_provider} - {message}",
            llm_provider=custom_llm_provider,
            model=model,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. The provider rate-limited the request; retry with exponential backoff.
  2. Reduce request rate, raise provider quotas, or configure router fallbacks to other deployments.
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:291 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/9ee9abdca3e6b16e. Report an issue: GitHub.