BerriAI/litellm · error · BadGatewayError

AzureException BadGatewayError - {message}

Error message

AzureException BadGatewayError - {message}

What it means

Error "AzureException BadGatewayError - {message}" thrown in BerriAI/litellm.

Source

Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:2027

            )
        elif original_exception.status_code == 422:
            raise BadRequestError(
                message=f"AzureException BadRequestError - {message}",
                model=model,
                llm_provider="azure",
                litellm_debug_info=extra_information,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 429:
            raise RateLimitError(
                message=f"AzureException RateLimitError - {message}",
                model=model,
                llm_provider="azure",
                litellm_debug_info=extra_information,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 502:
            raise BadGatewayError(
                message=f"AzureException BadGatewayError - {message}",
                model=model,
                llm_provider="azure",
                litellm_debug_info=extra_information,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 503:
            raise ServiceUnavailableError(
                message=f"AzureException ServiceUnavailableError - {message}",
                model=model,
                llm_provider="azure",
                litellm_debug_info=extra_information,
                response=getattr(original_exception, "response", None),
            )
        elif original_exception.status_code == 504:  # gateway timeout error
            raise Timeout(
                message=f"AzureException Timeout - {message}",
                model=model,

View on GitHub (pinned to 6c2dcb801b)

Solutions

  1. Azure gateway error; retry with backoff and check Azure status.

When it happens

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