Skip to main content
This page is a catalog of every error code you can encounter when using the Batch and Files APIs, what each one means, and what to do about it.

Error response shape

All errors (other than CORS preflight) return JSON in the OpenAI-compatible envelope:
  • message is always present.
  • type is always present. Values mirror OpenAI’s vocabulary: invalid_request_error, authentication_error, rate_limit_exceeded, internal_error, plus insufficient_quota on 429 responses.
  • code is a machine-readable string (e.g. invalid_purpose, file_not_found, insufficient_quota). null when not meaningful.
  • param names the offending parameter ("model", "messages", "input_file_id", …) or is null.
  • line is included for JSONL validation failures during POST /v1/batches to point at the offending line (1-based).
Every response, success or error, also carries an x-request-id response header (format req_<token>). Pass it along when reporting issues to support so the call can be located in logs.

HTTP status codes

Quota errors return 429Catch 429 for both quota exhaustion (error.type: “insufficient_quota”) and rate-limiting (error.type: “rate_limit_exceeded”). This matches OpenAI’s behaviour and works with the official SDK’s built-in retry logic.

Common synchronous errors

401 Unauthorized, missing headers

Cause: x-api-key was not sent. Fix: Send the required x-api-key header on every request. x-project-id is optional, and only needed to scope the request to a specific project.

403 Forbidden, invalid credentials

Cause: The API key doesn’t exist, is inactive, or belongs to a different project than the one in x-project-id. Fix: Verify the key, and verify the project UUID matches.

429 Insufficient Quota

Cause: Your organization has zero balance and zero free credits. Fix: Top up your balance.
Important: quota is checked at line-execution time. If your balance drops to zero during a batch, the remaining lines fail with error.code: "insufficient_quota" in the error file (the JSONL line’s error.message includes the legacy [legacy:http_420] prefix for forensics). The batch as a whole still transitions to completed once all lines have been accounted for.

404 Not Found, file or batch

Cause: The ID does not exist, or it belongs to another project, or it has been soft-deleted. The same 404 is returned in all three cases. Fix: Verify the ID and the x-project-id you’re sending.

Files API errors


Batches API. POST /v1/batches validation errors

When you create a batch, the service streams the entire input JSONL and validates every line synchronously before returning a response. Any failure returns 400 with the offending line (1-based, mirroring OpenAI’s BatchError.line). The batch is also persisted with status: "failed" and a populated errors list, so subsequent GET /v1/batches/{id} calls can introspect what went wrong. Validation errors carry line in the JSON body so you can locate and fix the offending line:

Errors that appear in the error_file_id JSONL

A line can fail after the batch was successfully created. Each failed line is recorded in the error file with the line’s original custom_id and an error object. These are the codes you’ll see: The original ZeroGPU code is preserved as a [legacy:<old_code>] prefix on error.message for forensics. No error.details field is emitted - the relevant upstream detail (if any) is folded into the message.

Recovering from failures

A batch that ends with some failures is still status: "completed". The pattern for handling this is:
  1. Read output_file_id and write successful results to your data store.
  2. Read error_file_id and partition by error.code:
    • invalid_request_error, not_found_error, request_too_large: client-side issues, log, fix the input lines, and resubmit.
    • internal_error, rate_limit_exceeded: transient, resubmit as-is.
    • insufficient_quota, authentication_error: operational, fix the underlying issue first, then resubmit.
    • batch_cancelled, batch_expired: the lines never ran; resubmit them in a fresh batch.
  3. Build a smaller JSONL containing only the lines you want to retry, upload, and create a new batch.
Because custom_id is preserved end-to-end, retries are easy to deduplicate into your existing data store.

When to contact support

Reach out to ZeroGPU support if you see:
  • Persistent 500 responses from any endpoint.
  • Input file object missing on a file you just uploaded.
  • A batch stuck in finalizing for more than 10 minutes.
  • A batch that completes but is missing both output_file_id and error_file_id while request_counts.total is non-zero.

Next steps

Objects & lifecycle →

The Batch object, status lifecycle, and every endpoint.

JSONL format →

Line schemas for input, output, and error files.

Quickstart →

First batch in under 10 minutes, auth, upload, create, download.