{"record":{"id":"9a52c5ee23a36bea","repo":"BerriAI/litellm","slug":"badgatewayerror-exception-provider-message","errorCode":null,"errorMessage":"BadGatewayError: {exception_provider} - {message}","messagePattern":"BadGatewayError: (.+?) - (.+?)","errorType":"exception","errorClass":"BadGatewayError","httpStatus":502,"severity":"error","filePath":"litellm/litellm_core_utils/exception_mapping_utils.py","lineNumber":457,"sourceCode":"            )\n        elif original_exception.status_code == 429:\n            raise RateLimitError(\n                message=f\"RateLimitError: {exception_provider} - {message}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                response=getattr(original_exception, \"response\", None),\n                litellm_debug_info=extra_information,\n            )\n        elif original_exception.status_code == 500:\n            raise InternalServerError(\n                message=f\"InternalServerError: {exception_provider} - {message}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                response=getattr(original_exception, \"response\", None),\n                litellm_debug_info=extra_information,\n            )\n        elif original_exception.status_code == 502:\n            raise BadGatewayError(\n                message=f\"BadGatewayError: {exception_provider} - {message}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                response=getattr(original_exception, \"response\", None),\n                litellm_debug_info=extra_information,\n            )\n        elif original_exception.status_code == 503:\n            raise ServiceUnavailableError(\n                message=f\"ServiceUnavailableError: {exception_provider} - {message}\",\n                model=model,\n                llm_provider=custom_llm_provider,\n                response=getattr(original_exception, \"response\", None),\n                litellm_debug_info=extra_information,\n            )\n        elif original_exception.status_code == 504:  # gateway timeout error\n            raise Timeout(\n                message=f\"Timeout Error: {exception_provider} - {message}\",\n                model=model,","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/BerriAI/litellm/blob/6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d/litellm/litellm_core_utils/exception_mapping_utils.py#L439-L475","documentation":"Error \"BadGatewayError: {exception_provider} - {message}\" thrown in BerriAI/litellm.","triggerScenarios":"Thrown at litellm/litellm_core_utils/exception_mapping_utils.py:457 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provider gateway error; retry with backoff and check provider status."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"6c2dcb801bf2b75c18f1bb24140e7cf57465cc4d","analyzedAt":"2026-08-15T07:12:03.035Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}