# Errors

> Each error has an HTTP status and a stable code. Branch on the code; show the message.

```json Example
{
  "error": {
    "code": "forbidden",
    "message": "API key ci needs the role owner on acme for credit-add. See shako access ls, https://shako.dev/docs/access-control.md"
  }
}
```

**error.code** `string`

A stable code for programs. Branch on it.

**error.message** `string`

The text for people. Do not parse it.

## Codes

| HTTP | Code | When |
|---|---|---|
| 400 | `invalid` | A field, a value or the body is not correct. The message names the field. |
| 401 | `unauthorized` | No key, a removed key, or an expired key. |
| 402 | `no_credit` | The credit of the tenant is used up. Its VMs sleep until a top-up. |
| 403 | `forbidden` | The role of the key is too low for the endpoint. |
| 403 | `quota` | A limit: the VMs or the secrets of a tenant, or the tenants of an account. |
| 404 | `not_found` | No such endpoint, VM, secret or device, or no such tenant for the key. |
| 409 | `conflict` | The state of the VM does not allow the call, or another call holds the VM. Try again later. |
| 409 | `no_tenant` | The account has no tenant yet. |
| 429 | `rate_limited` | Too many calls. Wait, then try again. |
| 500 | `internal` | An error in Shako. |
| 502 | `not_listening` | The VM is awake, but no program accepts connections on the port. |
| 503 | `unreachable` | A part of Shako does not answer. Try again. |
| 507 | `box_full` | The host has no memory or disk left. |
