Errors & rate limits

Pendra uses standard HTTP status codes, and every error has a message that says what went wrong and what to do. If you need help, quote the X-Request-Id header to support.

What an error looks like

{
  "detail": "Invalid request. messages: Field required",
  "error": {
    "message": "Invalid request. messages: Field required",
    "type": "invalid_request_error"
  }
}

Read the message from error.message, or from detail. To handle an error in code, check error.type or error.code rather than the message text. Private inference errors put the error object inside detail.

Status codes

CodeMeansWhat to do
400 Something in the request is wrong, such as a prompt longer than the model's context, or messages in an order the model can't take. Fix the request. The message says what's wrong.
401 The API key is missing or wrong. Check the key.
403 The key or your role isn't allowed to do this, or your organisation requires encrypted requests. The message names what's missing. See Key permissions.
404 The model isn't installed, no worker can run it, or it doesn't do what this endpoint asks. The message says which, and what to do. See Installing a model.
409 The model is still installing on the worker that took the request, or one of its files is missing. Retry once the install finishes, or install the model again.
413 422 The request is too big, for example audio over 25 MB or a request over 39 MB, its answer is too big to send back, or a field is missing. See Missing fields. Send less or ask for less at once, or smaller images.
415 An image is in a format Pendra can't read, or is damaged. Send PNG, JPEG, GIF, BMP or WebP.
429 Every worker serving the model is busy. Wait for Retry-After seconds, then retry. See Busy workers.
500 Something went wrong at Pendra. Retry once. If it happens again, contact support.
501 The worker can't run this model, or this feature of it, at all. Use another model or another worker. Retrying won't help.
502 The worker failed while answering. Retry. Pendra picks another worker.
503 No worker serving the model is online. On text to speech, also a WAV reply that wasn't ready within 115 seconds, with X-Pendra-Error-Code: raw_response_deadline. Start a worker, or retry after Retry-After. For raw_response_deadline, don't retry: ask for JSON or send shorter text. See Text to speech.
504 The request ran for more than about 30 minutes. Split it into smaller requests.
507 The model, or the image you sent, needs more GPU memory than the worker has. Use a smaller model or image size, or a bigger GPU.

Busy workers

Pendra doesn't limit requests by plan. How many run at once depends on your workers. When they're all busy, Pendra holds a request for up to about 30 seconds, so short bursts still go through. After that you get a 429 with a Retry-After header, in seconds, sized to how busy the model is.

  • Wait that long, adding a little random delay, then retry.
  • The Pendra SDKs raise RateLimitError with the wait as retry_after (retryAfter in Node).
  • To get through more at once, add workers. See Batch inference.

The one fixed limit is renting GPUs, at one rental per API key per minute. See GPU rental.

Retries

Every inference endpoint is safe to retry. A retried chat or image request gives a fresh answer.

Specific errors

Missing fields

A missing field, or one of the wrong type, gets a 422. Its errors list names each field, as a dotted path such as messages.0.role:

"errors": [
  { "field": "messages", "message": "Field required", "type": "missing" }
]

Ambiguous model name

A name like qwen3.5:2b matches every version of it you've installed. If that's more than one, you get a 400 with error.code model_ambiguous, listing the exact names. Send one of those instead.

Invalid model name

A model name longer than 256 characters, or one with a quote, a backslash or an unprintable character in it, gets a 400 with error.code invalid_model_name. The Anthropic endpoint answers invalid_request_error instead. Send the id as the models list shows it.

Private inference errors

These come from end-to-end encryption. Check detail.error.type:

  • e2e_required (403): your organisation requires encrypted requests, and this one wasn't. Turn on private inference in the SDK. Live microphone transcription and /messages/count_tokens can't be used while this is on.
  • speech_encryption_unsupported (400, in error.code): the workers with this speech model are too old to make encrypted speech. Update them and send it again.
  • plan_required (403): private inference needs the Pro or Enterprise plan.
  • invalid_encrypted_request (400): the encrypted request is malformed. Use the Pendra SDK, and keep it up to date.

A 503 with X-Pendra-Error-Code: no_private_inference_worker means no online worker holds the key the request was encrypted for. Usually your workers have changed key since the client fetched it, so fetch it again and retry.

Moderation errors

POST /v1/moderations returns these in error.code:

StatusCodeMeans
400model_not_moderationThe model isn't a moderation model.
400image_input_not_supportedThe model checks text only. Send images to one that checks images, such as singguard:4b.
400encrypted_input_not_supportedYour SDK is too old to encrypt moderation checks. Update it.
400moderation_invalid_inputThe input isn't valid, or has more images than the model checks at once.
404model_not_foundThe model isn't in the catalogue.
409moderation_unavailableNo online, up-to-date worker has the model. Retrying won't help until you install it or bring a worker online.
429moderation_capacityEvery worker with the model is busy. Retry after Retry-After.
502moderation_invalid_verdictThe model gave no clear verdict. Treat the content as unchecked.
503moderation_unavailableThe worker running the check failed. Retry after Retry-After.

Errors on a slow request

After about 80 seconds, Pendra sends the 200 early to keep the connection open. If the request fails after that, the body is an error object rather than a result, with the real status in code:

{"error": {"message": "Worker 'gpu-box-1': disconnected while handling this request.", "type": "worker_error", "code": 503}}

So on long requests, check for an error key rather than trusting the status alone. Streams work the same way once they've started. See Errors on a stream.

Useful headers

HeaderTells you
X-Request-IdThe request's id. Quote it to support.
Retry-AfterSeconds to wait before retrying a 429 or 503. Not sent with raw_response_deadline.
X-Pendra-Queue-DepthOn a 429, how many requests were already waiting.
X-Pendra-Error-CodeA code to check in your own code, on some errors.
X-Worker-Id, X-Worker-NameThe worker that served the request. A name with accents or other non-ASCII characters is URL-encoded after a UTF-8'' prefix.