# Creative Lab error reference

Source: [Creative Lab error reference](<https://docs.gptunnel.ru/en/creative-lab/errors/>)

<a id="_top"></a>
A successful request returns HTTP `200` with `code: 0` in the response body. An error returns the corresponding HTTP status and a machine-readable value in `code`.

<a id="response-format"></a>
## Response Format

```json
{
  "code": 5,
  "message": "Insufficient balance, check account balance.",
  "trace_id": "662f1a9c4b1e2d0012a3b4c5"
}
```

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | `number` | yes | Error code. `0` indicates success. See the table below for error codes. |
| `message` | `string` | yes | Human-readable error description. |
| `details` | `array` | no | Details of the validation of input data (at present) `code: 3`). |
| `trace_id` | `string` | no | Request identifier for support (in internal errors, `code: 1`). |

<a id="authentication"></a>
## Authentication

A missing or invalid API key returns HTTP `401` with `{ "error": { "message": "Unauthorized" } }` in the response body. Check the `Authorization` header.

 <a id="errors-available"></a>
 
<a id="error-codes"></a>
## Error codes

| Code | HTTP | Message |
| --- | --- | --- |
| 1 <a id="error-1"></a> | 500 | Internal server error. |
| 3 <a id="error-3"></a> | 400 | Invalid input, check schema issues. |
| 5 <a id="error-5"></a> | 402 | Insufficient balance, check account balance. |
| 6 <a id="error-6"></a> | 429 | API key limit exceeded. Check your daily or monthly limits. |
| 7 <a id="error-7"></a> | 403 | Model is not available for this account (banned or restricted). |
| 20 <a id="error-20"></a> | 404 | Model not found or is not available via the LAB API. |
| 21 <a id="error-21"></a> | 410 | Model is deprecated or not available for this organization. |
| 22 <a id="error-22"></a> | 404 | Task not found in LAB API v2. Only tasks created via LAB API v2 are available here. |
| 23 <a id="error-23"></a> | 409 | Task with this idempotency\_key already exists with different input. |
| 24 <a id="error-24"></a> | 404 | Model is not available for this API key. Request GET /api/v2/media/models to see the models available to you. |
| 25 <a id="error-25"></a> | 400 | Input file was rejected by the model. Check its size, format, resolution and aspect ratio. |
| 26 <a id="error-26"></a> | 400 | Prompt was rejected by the model. Check its length and content. |
| 27 <a id="error-27"></a> | 400 | Requested combination of parameters is not supported by this model. |
| 28 <a id="error-28"></a> | 503 | Generation failed for a reason we could not attribute. Repeat the same request later; if it keeps failing, check the input files and their URLs. |
| 29 <a id="error-29"></a> | 403 | Model is not allowed for this API key. Adjust allowed models in the dashboard or use another key. |
| 30 <a id="error-30"></a> | 429 | Too many generation requests. Retry after the window resets. |
| 31 <a id="error-31"></a> | 429 | Too many tasks running at once. Wait for the current ones to finish. |
| 99 <a id="error-99"></a> | 404 | API method not found, check the URL. |
| 1001 <a id="error-1001"></a> | 400 | Sensitive content has been detected in your request or uploaded files. Please check the text and media and try again. |
| 1002 <a id="error-1002"></a> | 400 | Request was blocked by moderation. |

<a id="an-empty-prompt-when-calculating-kling-price"></a>
### An empty prompt when calculating Kling price

**`ERR_EMPTY_PROMPT`** <a id="error-empty-prompt"></a>
 When you request a price for `kling-v3`, the API returns HTTP `400` with `code: 3` and `details[].message: "ERR_EMPTY_PROMPT"` if the prompt is missing or appears only inside `params`. Add [`prompt` at the top level of the request](<https://docs.gptunnel.ru/en/creative-lab/price/#request-prompt>) alongside `model`, then request the price again.

For `kling-image-v4-product`, include an image in `inputs.image`. If the image is present and the prompt is missing, the API returns the same error.

> **Caution: Status 429: three different reasons**
>
> For HTTP `429`, check the response’s `code` to decide how to recover.
>
>
>
> - `6`: The API key has reached its daily or monthly limit. Check both limits in the dashboard.
> - `30`: Too many tasks were created per minute. The response includes a `Retry-After` header with the number of seconds until the rate window clears. Wait at least that long before retrying.
> - `31`: Too many tasks are running concurrently. Wait for some tasks to reach `status: done` or `failed`, then retry.
>
>
>
> Only `code: 30` includes `Retry-After`. For codes `6` and `31`, use the recovery steps above.
>
>
>
> An immediate retry after `429` will hit the same limit. For batch submissions, queue tasks in your application and keep the submission rate below your limit.

> **Note: Codes 25 - 28 and 1001 - 1002 come to the task object**
>
> If generation fails, the task has `status: failed` and these codes appear in its `error` field. If the API cannot read an input file before task creation, it can return `code: 25` immediately. See [Get a task](<https://docs.gptunnel.ru/en/creative-lab/get-task/>). Use `error.title` to distinguish reasons that share a code. For example, `ERR_IMAGE_TOO_LARGE` and `ERR_UNSUPPORTED_FILE_FORMAT` both use `code: 25`. New reasons can be added without changing the code table.

> **Caution: The failure codes have changed**
>
> Previously, most task failures returned `code: 1` and appeared as internal errors. The API now returns specific codes `25`–`28` and provides the exact reason in `error.title`.
>
>
>
> If your code handles `error.code` on tasks with `status: failed`, update the handlers. Some failures that previously used `1` now use `25`–`28`, `1001` or `1002`. Three failures previously used v1 codes.
>
>
>
> - Provider overload now uses `28`. It used `6`, which in v2 means the API key has reached its limit.
> - A missing input image now uses `25`. It used `400`, which is not a v2 error code.
> - A model without frame-pair support now returns `27` for a frame pair. It used `400`.
>
>
>
> Code `1` means an unclassified service failure. Use `error.title` to handle specific causes. Existing titles remain stable when new causes are added.

> **Note: Error 21**
>
> The API returns `code: 21` if a provider retires the requested model without a replacement, or if the model is unavailable to your organization. If a retired model has a replacement, task creation uses it and does not return this error for retirement alone. `original_id` contains the requested model ID.
>
>
>
> ```json
> {
>   "code": 21,
>   "message": "Model is deprecated or not available for this organization.",
>   "original_id": "kling-v2"
> }
> ```
>
>
>
> See [Deprecated models](<https://docs.gptunnel.ru/en/getting-started/deprecated-models/>).

> **Note: Idempotency key already used**
>
> The API returns `code: 23` when the `idempotency_key` was used for a different request. Use a new key or retry the original request unchanged.
