# Errors

Source: https://www.pingtower.com/docs/reference/errors/

Every non-2xx response is a JSON object with an error string. Some carry more.

```json
{ "error": "validation failed",
  "fields": [ { "field": "name", "message": "must not be empty", "rule": "required" } ] }
```

| Status | When | Extra fields |
| --- | --- | --- |
| `400` | The body or a parameter failed validation. | `fields[]` with `field`, `message`, `rule`. |
| `401` | Bearer missing, malformed, or not the kind this route takes. | |
| `403` | Your role cannot do this: a member renaming a project, an admin inviting an owner. | |
| `404` | Unknown project, source, rule, alert, or a tenant you are not a member of. | |
| `409` | Conflict. Deleting something a rule still names; removing the last owner; an email already taken; a disabled integration asked to test. | `rules[]` for a referenced source, action or schedule; `schedules[]`, `escalations[]`, `overrides[]` for a referenced member. |
| `422` | The request was well-formed but points at something that does not exist: a rule naming an unknown action, a schedule naming a non-member. | `errors[]` when more than one. |
| `429` | Over a rate limit or a storage quota. | `Retry-After` header, whole seconds. |
| `500` | The daemon could not store or read. | |
| `503` | A test route was called on a daemon with no sender or executor configured. | |

## The referenced-error shape

```json
{ "error": "store: source is referenced by rules: gateway-timeouts, errors",
  "rules": ["gateway-timeouts", "errors"] }
```

Returned on `DELETE` of a source, action or on-call schedule, and on renaming an action, while a rule still references it. Edit or delete those rules first.

## Two kinds of 429

`{"error": "rate limit exceeded"}` is the plan's per-second rate; wait `Retry-After` and send again. `{"error": "storage quota exceeded"}` is the plan's retained-rows cap, and waiting will not clear it; the line was still evaluated for alerting.
