# Errors

Errors answer `{"error": {"code", "message", "request_id"}}` with an HTTP status. Check `code` in your code: it is stable. `message` is for people and may change. Quote `request_id` when you contact support. Besides the codes of each endpoint, any request can get `401 invalid_key` (no key, or an unknown, revoked or regenerated one), `403 key_creator_gone`, `403 key_access_denied` (above the key's access or its creator's role), `403 origin_not_allowed`, `404 not_available_with_key`, `413 payload_too_large`, `429 rate_limited`, and on writes `400 idempotency_key_required`, `409 request_in_progress` and `422 idempotency_key_reused`.

## Error response

### Error response · 422

```json
{
  "error": {
    "code": "region_not_eligible",
    "message": "A service with a volume runs in one region.",
    "request_id": "req_7f3a9c21d84be056"
  }
}
```

## Error codes

| Status | Code | Meaning | Retry |
|---|---|---|---|
| 400 | `confirm_required` | Send confirm: true. | no |
| 400 | `invalid_config` | The file is not valid. The message names every problem, with its key. | no |
| 400 | `invalid_domain` | That isn't a domain you can add. | no |
| 400 | `invalid_limit` | limit is 1 to 750. | no |
| 400 | `invalid_range` | range is 1h, 3h, 24h, 7d or 30d. | no |
| 400 | `invalid_request` | A field is missing or not valid. The message names it. | no |
| 400 | `invalid_tail` | tail is 0 to 750. | no |
| 400 | `invalid_url` | The URL is not https, or resolves to a private address. | no |
| 404 | `not_found` | No such object in the key's project (or environment). | no |
| 409 | `account_frozen` | The workspace is out of credits: add credits on the dashboard to create, change or deploy. | no |
| 409 | `apply_failed` | A step was refused. The changes before it were applied. | no |
| 409 | `console_unavailable` | Shells aren't available in this region yet. | no |
| 409 | `deployment_finished` | It has already finished. | no |
| 409 | `domain_connect_unsupported` | The provider doesn't support Domain Connect. | no |
| 409 | `domain_taken` | Another service uses that domain. | no |
| 409 | `invalid_state` | The service is stopped or being deleted. | no |
| 409 | `name_taken` | The environment already has a group with that name. | no |
| 409 | `not_running` | The service has no running replica. | no |
| 409 | `not_startable` | Dispra stopped this service: it starts again once that is resolved. | no |
| 409 | `plan_stale` | The environment changed since the plan: the error carries the new plan. | no |
| 409 | `production_environment` | The production environment can't be deleted. | no |
| 409 | `region_exists` | The service already runs there. | no |
| 409 | `region_last` | The service runs only there. | no |
| 409 | `service_replicas_volume` | A service with a volume runs one replica. | no |
| 409 | `stale_generation` | Someone changed it since you read it: read it again and retry. | no |
| 409 | `variable_in_use` | A service still uses it. | no |
| 409 | `volume_attached` | A service uses it: detach it first. | no |
| 409 | `volume_name_taken` | The environment has a volume with that name. | no |
| 409 | `volume_not_eligible` | The service runs more than one replica or region. | no |
| 422 | `region_not_eligible` | A service with a volume runs in one region. | no |
| 429 | `rate_limited` | Checked less than 10 seconds ago. | yes |
| 503 | `logs_unavailable` | Logs can't be read right now. Retry shortly. | yes |

## Retries

Retry 429, 502, 503 and 504 with exponential backoff, waiting at least Retry-After seconds, and always with the same Idempotency-Key so a retried write is never done twice. Don't retry other 4xx errors unchanged: fix the request first.
