BerriAI/litellm · error · BadGatewayError

AnthropicException BadGatewayError - {error_str}

Error message

AnthropicException BadGatewayError - {error_str}

What it means

Error "AnthropicException BadGatewayError - {error_str}" thrown in BerriAI/litellm.

Source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:585

                message=f"AnthropicException - {error_str}",
                model=model,
                llm_provider="anthropic",
            )
        elif original_exception.status_code == 429:
            raise RateLimitError(
                message=f"AnthropicException - {error_str}",
                llm_provider="anthropic",
                model=model,
            )
        elif original_exception.status_code == 500 or original_exception.status_code == 529:
            raise litellm.InternalServerError(
                message=f"AnthropicException - {error_str}. Handle with `litellm.InternalServerError`.",
                llm_provider="anthropic",
                model=model,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 502:
            raise BadGatewayError(
                message=f"AnthropicException BadGatewayError - {error_str}",
                llm_provider="anthropic",
                model=model,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 503:
            raise litellm.ServiceUnavailableError(
                message=f"AnthropicException - {error_str}. Handle with `litellm.ServiceUnavailableError`.",
                llm_provider="anthropic",
                model=model,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 504:  # gateway timeout error
            raise Timeout(
                message=f"AnthropicException Timeout - {error_str}",
                model=model,
                llm_provider="anthropic",
                exception_status_code=original_exception.status_code,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Anthropic gateway error; retry with backoff.

When it happens

Trigger: Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:585 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of BerriAI/litellm@6c2dcb801b (2026-08-15). Data as JSON: /api/errors/5c47a6f2b997b019. Report an issue: GitHub.