> ## Documentation Index
> Fetch the complete documentation index at: https://openrouter-d02e98a0-mintlify-7021d5f4.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# BadGatewayResponseError - Python SDK

> BadGatewayResponseError error handling

<Warning>
  The Python SDK and docs are currently in beta.
  Report issues on [GitHub](https://github.com/OpenRouterTeam/python-sdk/issues).
</Warning>

Bad Gateway - Provider/upstream API failure

## Fields

| Field                 | Type                                                                                                               | Required             | Description                       | Example                                              |
| --------------------- | ------------------------------------------------------------------------------------------------------------------ | -------------------- | --------------------------------- | ---------------------------------------------------- |
| `error`               | [components.BadGatewayResponseErrorData](/client-sdks/python/api-reference/components/badgatewayresponseerrordata) | :heavy\_check\_mark: | Error data for BadGatewayResponse | `{"code": 502,"message": "Provider returned error"}` |
| `openrouter_metadata` | Dict\[str, *Nullable\[Any]*]                                                                                       | :heavy\_minus\_sign: | N/A                               |                                                      |
| `user_id`             | *OptionalNullable\[str]*                                                                                           | :heavy\_minus\_sign: | N/A                               |                                                      |
