> ## Documentation index
> Fetch the complete documentation index at: https://tryjuice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Errors & limits

> Error codes, limits, queueing and when to retry.

Source: https://tryjuice.ai/platform/docs/errors-and-limits.md

## Error format

Errors are JSON, with a `code` that never changes, a `message` you can show, and the request id:

*400 Bad Request*

```json
{
  "error": {
    "code": "INVALID_REQUEST",
    "message": "The request did not match the schema.",
    "request_id": "req_Q2x7Lm9TbVw4Nk8RcZ1s",
    "details": {
      "issues": [
        {
          "path": "prompt",
          "message": "Invalid input: expected string, received undefined"
        }
      ]
    }
  }
}
```

`details.issues` lists each invalid field; `details.header` names a malformed header.

## Error codes

| Status | Code | Meaning | What to do |
| --- | --- | --- | --- |
| `400` | `INVALID_REQUEST` | Something in the request is invalid: a field, a header, the JSON, the model or the cursor. | Fix it: the message and `details` say what. |
| `401` | `UNAUTHORIZED` | The key is missing, wrong, revoked or expired. | Check the Authorization header and the key under API keys. |
| `402` | `INSUFFICIENT_FUNDS` | Your account needs a positive credit balance (and enough headroom across in-flight runs) to start every generation you asked for. Nothing was created; `details` has `balance_usd`, `in_flight_designs`, `estimated_per_design_usd` and `billing_url`. | Add credits under Billing, or turn on auto-reload. |
| `403` | `PLATFORM_ACCESS_DISABLED` | The Juice team turned off your API access. | Ask the Juice team to turn it back on. |
| `403` | `REQUEST_NOT_ALLOWED` | The prompt or an attached image is against our usage policy, or the design can’t be shared publicly. Nothing was created. | Send a different prompt or image. |
| `404` | `NOT_FOUND` | No such generation on your account, or no such path. | Check the id. |
| `409` | `GENERATION_NOT_COMPLETED` | The job has no design yet, or never will (it failed or was canceled). | Wait for it to complete, or make a new one. |
| `413` | `PAYLOAD_TOO_LARGE` | The body is over 32 MiB. | Send large images as URLs. |
| `429` | `TOO_MANY_REQUESTS` | Your account already has 12 jobs pending or processing. Nothing was created. | Wait for one to finish, then retry after `Retry-After`. |
| `500` | `INTERNAL_ERROR` | Something broke on our side. | Retry with the same `Idempotency-Key`. |
| `503` | `PLATFORM_UNAVAILABLE` | Juice is unavailable right now. | Retry in a bit. |

A failed job isn’t an HTTP error: the job says what went wrong. See [Job errors](https://tryjuice.ai/platform/docs/generations.md#job-errors).

## Queueing

Every job is queued and starts as soon as there’s room: when it’s busy, a job stays `pending` a little longer. Your account can have up to 12 jobs `pending` or `processing` at once, Playground runs included (`limits.max_active_jobs` in [GET /me](https://tryjuice.ai/platform/docs/generations.md#get-me)). A create that would go over answers `429 TOO_MANY_REQUESTS` with a `Retry-After` header and `details` with `active_jobs`, `max_active_jobs` and `requested`; nothing is created.

## Limits

| Limit | Default |
| --- | --- |
| `prompt` | 1 to 32,000 characters, after trimming |
| Request body | 32 MiB |
| `images` | Up to 4, each at most 20 MB |
| `reference_ids` | Up to 5 |
| `count` | 1 to 4 generations per request; 1 when left out |
| `wait_timeout_ms` | 1,000 to 290,000 ms, honored up to 60,000; 20,000 when left out |
| `seed` | 0 to 2,147,483,647 |
| `limit` of `GET /generations` | 1 to 100; 20 when left out |
| Run time of a job | 60 minutes, then it fails with TIMEOUT |
| Runs of a job | 4, restarts included; then it fails with INTERRUPTED |
| Images per design | Up to 20, filling up to 96 image slots |
| Jobs pending or processing at once | 12 per account |
| Retention | None: jobs and their images are kept until you delete them |

## Retries

- **Retry:** network failures, `500` and `503`, waiting a little longer each time (1 s, 2 s, 4 s…), and a `429` after its `Retry-After`.
- **Retrying a create?** Send an `Idempotency-Key` so you get the same job back, not a second one. See [Idempotency](https://tryjuice.ai/platform/docs/authentication.md#idempotency).
- **Don’t retry unchanged:** `400`, `401`, `402`, `403`, `404`, `409` and `413`.
