> For the complete documentation index, see [llms.txt](https://docs.ionos.com/cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.ionos.com/cloud/ai/ai-model-hub/error-codes.md).

# Error Codes

This guide lists the error codes returned by the <code class="expression">space.vars.ionos\_cloud\_ai\_model\_hub</code> API, their causes, and their solutions.

## Error format

Every error response carries an HTTP status and a JSON body listing one or more messages. Each message has a machine-readable `errorCode` and a human-readable `message`:

```json
{
  "httpStatus": 400,
  "messages": [
    {
      "errorCode": "VALIDATION_ERROR",
      "message": "field 'messages' must not be empty"
    }
  ]
}
```

Branch on `errorCode` rather than on `message`. The message is written for people and may be reworded, while the code is part of the API contract. A request that fails validation in more than one way returns one entry per problem, so a client can report them together.

{% hint style="info" %}
**Note:** The `529` overload response is the only exception to this pattern; it follows the OpenAI error format described in [Capacity errors](#capacity-errors).
{% endhint %}

## API errors

This table lists all API error codes grouped by **Type**:

* Client errors caused by invalid requests
* Model errors caused by model serving issues
* Capacity errors caused by rate limiting
* Server errors caused by internal failures

| **Code**                                                                                                                                     | **Type** | **Overview**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| -------------------------------------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `400` - `VALIDATION_ERROR`                                                                                                                   | Client   | <p><strong>Cause:</strong> A field is missing, malformed, or outside its documented range, such as a <code>temperature</code> above 2 or a tool definition without a <code>function.name</code>.<br><strong>Solution:</strong> The message names the field. Correct it and resend. Retrying unchanged always fails.</p>                                                                                                                                                                                                     |
| `400` - `INVALID_JSON`                                                                                                                       | Client   | <p><strong>Cause:</strong> The request body is not valid JSON.<br><strong>Solution:</strong> Check for a truncated body, a trailing comma, or unescaped characters in a string.</p>                                                                                                                                                                                                                                                                                                                                         |
| `400` - `INVALID_MULTIPART`                                                                                                                  | Client   | <p><strong>Cause:</strong> A multipart form, such as an image edit request, could not be parsed.<br><strong>Solution:</strong> Check the form encoding and that every file part has a filename.</p>                                                                                                                                                                                                                                                                                                                         |
| `401` - `INVALID_TOKEN`                                                                                                                      | Client   | <p><strong>Cause:</strong> The token is missing, malformed, expired, or revoked.<br><strong>Solution:</strong> Check the token value and its expiry. For information on how to verify and renew it, see <a href="/cloud/ai/ai-model-hub/troubleshooting.md"><mark style="color:blue;">Troubleshooting</mark></a>.</p>                                                                                                                                                                                                       |
| `404` - `MODEL_NOT_SUPPORTED`                                                                                                                | Client   | <p><strong>Cause:</strong> The model does not exist, or it exists but cannot serve this endpoint. For example, an embedding model asked for a chat completion.<br><strong>Solution:</strong> Call <code>/v1/models</code> for the current list, and check the model card for the capabilities it advertises.</p>                                                                                                                                                                                                            |
| `404` - `ROUTE_NOT_FOUND`                                                                                                                    | Client   | <p><strong>Cause:</strong> The request path is not an endpoint of this API.<br><strong>Solution:</strong> Check the path against the API reference, including the <code>/v1</code> prefix.</p>                                                                                                                                                                                                                                                                                                                              |
| `405` - `METHOD_NOT_ALLOWED`                                                                                                                 | Client   | <p><strong>Cause:</strong> The endpoint exists but does not accept this HTTP method.<br><strong>Solution:</strong> Check the method for the endpoint in the API reference.</p>                                                                                                                                                                                                                                                                                                                                              |
| `413` - `RESOURCE_LIMIT_ERROR`                                                                                                               | Client   | <p><strong>Cause:</strong> The request exceeds a documented size or count limit, such as the number of documents in a rerank request or the size of an inline image.<br><strong>Solution:</strong> Split the request, or pass large media as a remote URL rather than inline.</p>                                                                                                                                                                                                                                           |
| `429` - `RATE_LIMIT_EXCEEDED`                                                                                                                | Client   | <p><strong>Cause:</strong> Your contract's rate limit is exhausted.<br><strong>Solution:</strong> Retry using exponential backoff (this response does not include a <code>Retry-After</code> header). Monitor the <code>X-RateLimit-Remaining-Requests</code> on successful responses to avoid reaching the limit. For more information, see <a href="/cloud/ai/ai-model-hub/how-tos/rate-limits.md"><mark style="color:blue;">Rate Limits</mark></a>.</p>                                                                  |
| `499` - `CLIENT_DISCONNECTED`                                                                                                                | Client   | <p><strong>Cause:</strong> The connection closed before the response was ready because the request was canceled or the caller timed out. The client never receives this error itself; it exists in logs only and is recorded so a canceled request is not counted as a service failure.<br><strong>Solution:</strong> No action is required. Tokens generated before the disconnect are billed, since the model produced them; canceling only limits further generation, not what was already produced.</p>                 |
| `4xx` - `UPSTREAM_REJECTED`                                                                                                                  | Model    | <p><strong>Cause:</strong> The model rejected the request. The status and explanation come directly from the model.<br><strong>Solution:</strong> Review the returned error message and adjust your request accordingly. Retrying the same request without changes will result in the same error.</p>                                                                                                                                                                                                                       |
| `422` - `UPSTREAM_NOT_IMPLEMENTED`                                                                                                           | Model    | <p><strong>Cause:</strong> The model understood the request but did not implement part of it. For example, a sampling parameter that the model does not support.<br><strong>Solution:</strong> Remove the unsupported parameter, or use a model that offers it. Retrying does not help.</p>                                                                                                                                                                                                                                 |
| `502` - `UPSTREAM_UNAVAILABLE`                                                                                                               | Model    | <p><strong>Cause:</strong> The model could not be reached, or it stopped before it completed answering.<br><strong>Solution:</strong> Retry after a brief wait. If it persists, check the status page and contact <a href="https://docs.ionos.com/cloud/support/general-information/contact-information"><mark style="color:blue;">IONOS CLOUD Support</mark></a>. A partial answer is never returned in place of a complete one, and an answer that was not completed is not billed.</p>                                   |
| `503` - `SERVICE_OVERLOADED`                                                                                                                 | Capacity | <p><strong>Cause:</strong> Too many large requests are currently in flight. Requests above 4 MiB, or those using chunked transfer encoding, are limited to two concurrent requests.<br><strong>Solution:</strong> Wait for the duration specified in the <code>Retry-After</code> header before retrying. To keep requests below the threshold, pass media via remote URLs rather than an inline base64 payload.</p>                                                                                                        |
| `529` - `user_overloaded`                                                                                                                    | Capacity | <p><strong>Cause:</strong> Your own requests are being throttled to protect overall service capacity.<br><strong>Solution:</strong> Wait for the duration specified in the <code>Retry-After</code> header before retrying, then resume sending requests at a lower rate.</p>                                                                                                                                                                                                                                               |
| `529` - `server_overloaded`                                                                                                                  | Capacity | <p><strong>Cause:</strong> Capacity is currently exhausted across the entire service.<br><strong>Solution:</strong> Wait for the duration specified in the <code>Retry-After</code> header before retrying.</p>                                                                                                                                                                                                                                                                                                             |
| `500` - `CHAT_COMPLETION_ERROR`, `COMPLETION_ERROR`, `EMBEDDING_ERROR`, `IMAGE_ERROR`, `RERANK_ERROR`, `RESPONSES_ERROR`, `CONVERSION_ERROR` | Server   | <p><strong>Cause:</strong> The request failed due to an internal server error on the <code class="expression">space.vars.ionos\_cloud</code> infrastructure. The code identifies which operation failed and is not intended for branching.<br><strong>Solution:</strong> The request may or may not have completed, so retries are only safe for idempotent operations. If the issue persists, report it using the instructions in <a href="#persistent-errors"><mark style="color:blue;">Persistent Errors</mark></a>.</p> |

### Model errors

A model error means the model failed to generate a response and instead returned an error code, timed out, or returned a system message.

### Capacity errors

A `503` or `529` error indicates temporary overload, not a client error or permanent outage. Clients that treat all non-`200` responses as final abandon requests that succeed shortly after. Both status codes include a `Retry-After` header indicating when to retry.

The `529` response uses the OpenAI error format rather than the format shown above, so read `error.code`:

```json
{
  "error": {
    "message": "The service is temporarily overloaded. Please try again shortly.",
    "type": "overloaded_error",
    "code": "server_overloaded"
  }
}
```

Always wait for the `Retry-After` interval rather than a fixed delay, so that clients do not retry in unison and prolong the overload. For the full retry guidance, see [<mark style="color:blue;">Rate Limits</mark>](/cloud/ai/ai-model-hub/how-tos/rate-limits.md).

{% hint style="info" %}
**Note:** Treat an error code you do not recognize as a generic failure of its HTTP status class. New codes may be added, and a client that rejects unknown codes breaks when one is.
{% endhint %}

## Handling errors in Python

The API is OpenAI-compatible, so the `openai` library raises its usual exception types based on the HTTP status. This is the simplest way to handle errors if you already use that library.

| Status       | Exception                               |
| ------------ | --------------------------------------- |
| `400`, `413` | `BadRequestError`                       |
| `401`        | `AuthenticationError`                   |
| `404`        | `NotFoundError`                         |
| `422`        | `UnprocessableEntityError`              |
| `429`        | `RateLimitError`                        |
| `5xx`        | `InternalServerError`                   |
| No response  | `APIConnectionError`, `APITimeoutError` |

```python
import openai
from openai import OpenAI

client = OpenAI(
    api_key="[YOUR API TOKEN HERE]",
    base_url="https://openai.inference.de-txl.ionos.com/v1"
)

try:
    response = client.chat.completions.create(
        model="[MODEL NAME HERE]",
        messages=[{"role": "user", "content": "Hello world"}]
    )
except openai.RateLimitError as e:
    # 429 carries no Retry-After; back off exponentially.
    print(f"Rate limited (request {e.response.headers.get('X-Request-Id')})")
except openai.BadRequestError as e:
    print(f"Fix the request before resending: {e}")
except openai.APIStatusError as e:
    print(f"Request failed with status {e.status_code}: {e}")
else:
    print(response.choices[0].message.content)
```

To read the `errorCode` itself, take it from the response body:

```python
except openai.APIStatusError as e:
    body = e.response.json()
    code = body["messages"][0]["errorCode"]
```

## Persistent errors

If an error keeps occurring, contact <code class="expression">space.vars.ionos\_cloud</code> support with:

* The model you were using.
* The HTTP status and the `errorCode` you received.
* The **response headers**, in particular `X-Request-Id` and `X-Gateway-Version` to locate the exact request.
* The timestamp and time zone of the request.

For details on how to capture the headers, see [<mark style="color:blue;">Troubleshooting</mark>](/cloud/ai/ai-model-hub/troubleshooting.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.ionos.com/cloud/ai/ai-model-hub/error-codes.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
