{"record":{"id":"9c945aca8c9954be","repo":"BerriAI/litellm","slug":"azureexception-badgatewayerror-message","errorCode":null,"errorMessage":"AzureException BadGatewayError - {message}","messagePattern":"AzureException BadGatewayError - (.+?)","errorType":"exception","errorClass":"BadGatewayError","httpStatus":502,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":2027,"sourceCode":"            )\n        elif original_exception.status_code == 422:\n            raise BadRequestError(\n                message=f\"AzureException BadRequestError - {message}\",\n                model=model,\n                llm_provider=\"azure\",\n                litellm_debug_info=extra_information,\n                response=getattr(original_exception, \"response\", None),\n            )\n        elif original_exception.status_code == 429:\n            raise RateLimitError(\n                message=f\"AzureException RateLimitError - {message}\",\n                model=model,\n                llm_provider=\"azure\",\n                litellm_debug_info=extra_information,\n                response=getattr(original_exception, \"response\", None),\n            )\n        elif original_exception.status_code == 502:\n            raise BadGatewayError(\n                message=f\"AzureException BadGatewayError - {message}\",\n                model=model,\n                llm_provider=\"azure\",\n                litellm_debug_info=extra_information,\n                response=getattr(original_exception, \"response\", None),\n            )\n        elif original_exception.status_code == 503:\n            raise ServiceUnavailableError(\n                message=f\"AzureException ServiceUnavailableError - {message}\",\n                model=model,\n                llm_provider=\"azure\",\n                litellm_debug_info=extra_information,\n                response=getattr(original_exception, \"response\", None),\n            )\n        elif original_exception.status_code == 504:  # gateway timeout error\n            raise Timeout(\n                message=f\"AzureException Timeout - {message}\",\n                model=model,","sourceCodeStart":2009,"sourceCodeEnd":2045,"githubUrl":"https://github.com/BerriAI/litellm/blob/77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8/litellm/litellm_core_utils/exception_mapping_utils.py#L2009-L2045","documentation":"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.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:2027 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Azure returned a bad gateway; retry after a short delay.","Check Azure status and any gateways between you and the deployment."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"77b7c6c40c0c5aa5fbcb1d6a1825ac39ca8829b8","analyzedAt":"2026-08-18T11:44:31.656Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}