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

# Errors and retries

> A request's error, its types and codes, and when to retry. API version 2026-11-25.

A request that `failed`, `expired` or `requires_action` carries `result.error`. A batch in `requires_action` carries `error`. HTTP errors are as described in [Errors](https://docs.metaphi.ai/kennet/api/errors.md).

```json theme={"dark"}
{
  "type": "invalid_request_error",
  "code": "input_invalid",
  "message": "The trace is not JSON, JSON Lines or UTF-8 text. Nothing was charged.",
  "param": "input_file_id",
  "action_url": null,
  "retryable": false
}
```

| Field | Description |
| - | - |
| `type` | See [error types](#error-types) |
| `code` | A stable code to switch on. See [error codes](#error-codes) |
| `message` | A sentence for a person. Wording may change |
| `param` | The request parameter at fault, on an `invalid_request_error`. `null` otherwise |
| `action_url` | The page to add credit, on a `billing_error`. `null` otherwise |
| `retryable` | `true` exactly when `type` is `api_error` |

## Error types

| Type | Meaning | What to do |
| - | - | - |
| `invalid_request_error` | The input can't be twinned | Fix the input, upload it again and create a new request |
| `rate_limit_error` | A usage quota was reached | Send it again after the quota's period |
| `billing_error` | Prepaid credit is exhausted | Add credit at `action_url`. The request resumes by itself |
| `api_error` | It failed on our side after our own retries | Send the same input again |

## Error codes

| Code | Type | Status | Meaning |
| - | - | - | - |
| `input_invalid` | `invalid_request_error` | `failed` | The trace is not JSON, JSON Lines or UTF-8 text |
| `input_expired` | `invalid_request_error` | `failed` | The upload expired before processing began |
| `quota_exceeded` | `rate_limit_error` | `failed` | A usage quota was reached for its period |
| `credit_exhausted` | `billing_error` | `requires_action` or `failed` | Prepaid credit is exhausted. `failed` when credit ran out before the request could run |
| `internal_error` | `api_error` | `failed` | An error on our side, after our retries were used up |
| `deadline_exceeded` | `api_error` | `expired` | Not finished within its time limit |

Nothing is charged for a request that did not succeed.

## Retries

* A request is retried on our side while it is `running`. You see `api_error` only once those retries are used up.
* A final status never changes. To retry a `failed` or `expired` request, create a new batch with its input. An input file is taken once, so upload it again.
* Retry an HTTP call that answers `retryable: true` with backoff, keeping the same `Idempotency-Key`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.