# Errors

> Error format, status codes and error codes.

Every error is JSON with a `code` to branch on and a `message` for people. Some errors add fields (like `missing_chunks`).

```json
{ "error": { "code": "bucket_full", "message": "This upload would take the bucket past its 10 GB limit (9.81 GB used, 0.00 GB in unfinished uploads).", "used_bytes": 10533397708, "pending_bytes": 0, "limit_bytes": 10737418240 } }
```

| Status | Code | What to do |
| --- | --- | --- |
| `400` | `bad_request` | A field is missing or invalid; the message says which |
| `400` | `bad_chunk`, `bad_chunk_size` | Use an index from 0 to `chunk_count - 1` and exactly `chunk_size` bytes (the last chunk is the remainder) |
| `400` | `checksum_mismatch` | The chunk changed on the way; send it again |
| `400` | `bad_ref`, `bad_path` | `ref` must be 40 hex characters; `path` a file path in the tree |
| `401` | `invalid_api_key`, `expired_api_key`, `missing_account_id`, `account_mismatch` | Check the key and the `X-Clatter-Account` header |
| `402` | `quota_exceeded` | This month's free tokens are used. [Contact us](https://help.clatterlabs.com/code-buckets/troubleshooting/cb-contact-support) for more |
| `403` | `insufficient_scope` | Create a key with the needed permission |
| `404` | `not_found` | The id doesn't exist on your account (or was deleted) |
| `409` | `limit_reached` | 100 projects per account, or 100 buckets per project |
| `409` | `project_not_empty` | Delete the project's buckets first |
| `409` | `upload_incomplete` | Send the chunks in `missing_chunks`, then complete again |
| `409` | `upload_closed` | The upload is already complete (or aborted) |
| `409` | `not_ready` | Wait for the upload to complete |
| `409` | `backup_limit` | Free keeps 1 backup: pass `"replace": true` or delete it |
| `413` | `bucket_full` | The bucket would pass 10 GB; delete objects or use another bucket |
| `413` | `too_large` | The file or body is over the limit |
| `413` | `use_chunks` | Over 1 GB: download chunk by chunk |
| `429` | `rate_limited` | Wait `Retry-After` seconds |
| `502` | `storage_error` | Retry; chunk operations are safe to repeat |
| `503` | `unavailable`, `storage_unavailable` | Retry in a moment |
