# Errors

> Every error code VAPI returns, what it means and what to do about it.

Errors are JSON with an HTTP status:

```json
{
  "error": {
    "code": "insufficient_funds",
    "message": "No free minutes or funds left. Top up or turn on pay as you go in the RM Cloud console: ...",
    "hint": "A person with the owner or admin role tops up the wallet at top_up_url; retry afterwards with the same Idempotency-Key.",
    "docs_url": "https://vapi.cloud.redge.media/guide/errors#insufficient_funds",
    "top_up_url": "..."
  }
}
```

`code` is stable: act on it, not on the message. `hint` (not always present) says what to do. Some errors add fields a program can use. A job that failed has the same `code`, `message` and `docs_url` in its `error`.

**Retry** `5xx` errors and network failures with the same `Idempotency-Key`, after `Retry-After` seconds when given. Do not retry `4xx` errors unchanged: fix the request first.

## Requests

### `invalid_request`

422. The request does not match the schema; `details` lists each field and what is wrong with it. The schemas are in `https://vapi.cloud.redge.media/openapi.json`.

### `not_found`

404. No such address. The endpoints are listed in the [OpenAPI schema](https://vapi.cloud.redge.media/docs).

### `method_not_allowed`

405. The address exists, but not with this HTTP method.

### `idempotency_key_reused`

409. This `Idempotency-Key` was used with a different request. Use a new key for a new request; the same key with the same body returns the original job.

## Keys and access

### `unauthorized`

401. No API key, or one that is unknown or revoked, or its organization is blocked. Send `Authorization: Bearer rmk_...` with a key from the [console](https://console.cloud.redge.media/api-keys).

### `key_expired`

401. The key's expiry date has passed. Ask an owner or admin of the organization for a new key.

### `key_not_allowed`

403. The key is limited to other services than VAPI.

### `key_read_only`

403. The key may read jobs, but not start or cancel them.

### `forbidden`

403. Only owners and admins of the organization may do this (for example list everyone's jobs with `scope=organization`).

### `auth_unavailable`

503. VAPI cannot check API keys right now. Retry after `Retry-After` seconds.

### `rmcloud_unavailable`

503. Redge Media Cloud is not reachable right now. Retry after `Retry-After` seconds.

## Inputs

### `upload_not_found`

404. No such upload of yours. Uploads are kept for 7 days.

### `upload_incomplete`

409. Nothing was uploaded to the upload yet. `PUT` the file's bytes to its `upload_url` first (`GET /v1/uploads/{id}` gives a fresh one), or give `input.url` instead.

### `input_empty`

422. The uploaded file is empty.

### `input_too_large`

413. The file is larger than 2 GB.

### `too_many_test_jobs`

429. Test keys' jobs are free, so an organization may run only a few at a time (3). Wait for one to finish, then retry after `Retry-After` seconds.

### `invalid_url`

422. The input URL is not an http or https address on the internet: it has no host, carries a password, or points at a private, loopback or reserved address.

### `fetch_failed`

The job failed: VAPI could not download the input URL (an error status, a timeout, a download over 15 minutes, too many redirects, or more than 2 GB; 200 MB with a test key). `message` says which. Check that the address works without signing in.

### `invalid_media`

The job failed: the file is not a video VAPI can read (no video stream, a broken file, an unknown frame rate).

### `input_too_long`

The job failed: the video is longer than 10 minutes. Cut it into parts.

### `input_not_wider_than_target`

The job failed: the source is not wider than the shape asked for (for example a vertical video reframed to 9:16).

### `input_gone`

409. The input of the job you are revising is no longer stored (uploads are kept for 7 days). Start a new job with the input.

### `duration_unknown`

409. An estimate for an upload whose length VAPI does not know yet. Give `duration_s`, or run a free `probe` on the upload first.

## Jobs and revisions

### `job_not_found`

404. No such job of yours.

### `job_not_succeeded`

409. Only a job that succeeded can be revised.

### `job_not_cancelable`

409. The job has already finished.

### `invalid_override`

422, or a failed job. An override names a scene that does not exist or combines fields that do not go together; `message` says which. Scene ids come from the job's `result.scenes`.

### `invalid_webhook`

422. The webhook URL is not an http or https address on the internet.

## Money

### `insufficient_funds`

402, or a failed job. The organization has no free minutes or money left for this. The error has `top_up_url`, `available_micros` and `free_remaining`; a failed job's message says how much was needed. A person with the owner or admin role tops up the wallet or turns on pay as you go in the console. Agents: stop and tell the person.

### `key_limit_reached`

402, or a failed job. The key's monthly spending limit does not cover this. An owner or admin can raise the limit in the console; it starts again on the 1st of the month.

## Processing

### `internal_error`

The job failed in a way that is our fault. It was retried; if it keeps failing with the same video, tell us its job id.

### `worker_lost`

The job failed because the machine processing it stopped, more than once. Start it again.

## The VAPI panel

These come from the browser panel only, never from requests with an API key.

### `csrf`

403. A request from the panel without its `X-VAPI-CSRF` header. Reload the panel.

### `not_a_member`

403. You are no longer a member of the organization chosen in the panel. Sign in again or pick another organization.

### `no_organization`

409. You are not a member of any organization: create one or join one in the [Redge Media Cloud console](https://console.cloud.redge.media).
