BerriAI/litellm · error · BadGatewayError
AzureException BadGatewayError
Error message
AzureException BadGatewayError - {message} What it means
Azure-specific status mapping: an upstream Azure exception with HTTP 429 is re-raised as RateLimitError, indicating the deployment or subscription quota was hit and the caller should back off or retry.
Solutions
- Azure returned a bad gateway; retry after a short delay.
- Check Azure status and any gateways between you and the deployment.
Defensive patterns
Strategy: retry
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@77b7c6c40c (2026-08-18).
Data as JSON: /api/errors/9c945aca8c9954be.
Report an issue: GitHub.
Appendix: 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 77b7c6c40c)