# Error codes

> Test vectors: Error codes. Shown here as it is in conformance/vectors/errors.json.

Protocol `0.1`. Covers: SPEC.md section 6 (the table of codes) and sections 4 to 16.

[Download errors.json](./errors.json): the file itself, as the conformance suite reads it.

## How to use it

The complete error code list of SPEC section 6, and numeric limits the spec states.

## Notes

`codes` is the complete list of SPEC 6, in the order of the table, with where the spec uses each.

## Fixed values

| key | value |
|---|---|
| `byeOk` | `OK` |

## codes

19 entries.

| `code` | `where` |
|---|---|
| `E_BAD_FRAME` | `4: invalid JSON, unknown t, missing field` |
| `E_VERSION` | `16 no common version` |
| `E_AUTH` | `5 failed hello, surface key required, key confirmation failed, transcript not well-formed` |
| `E_ORIGIN` | `5 origin not allowed for an agent credential or on the surface allowlist; surface url of another origin; 3 a surface on a socket that takes agents only` |
| `E_TOO_LARGE` | `4 oversize frame; 9 act result over 32 KiB; 12 consent arguments too large` |
| `E_UNKNOWN_METHOD` | `6 and 16 unknown method` |
| `E_BAD_ARGS` | `6 params nested too deeply; 9 unknown action, args fail the schema, a chat text or note out of bounds; 12 a chat 'to' that names no other agent that hears the speaker` |
| `E_NO_SURFACE` | `6 unknown surface id, or one the credential may not attach to` |
| `E_NOT_ATTACHED` | `8 no live grant` |
| `E_SCOPE` | `8 empty scope intersection, grant lacks scope, scope switched off by the person` |
| `E_DENIED` | `5 manifest pin; 8 attach deny; 9 act deny, private target, nav, stream.open without coordinates; 12 a chat 'to' from an agent that no other agent hears` |
| `E_CONSENT` | `8 attach refused; 9 act refused; 12 third refusal revokes, the person's rule deny` |
| `E_PAUSED` | `9 pause; 12 indicator not usable, the person keeps using the page` |
| `E_RATE` | `8 attach burst; 11 pointer rate; 12 cool-off; 13 token buckets and admission` |
| `E_NO_TARGET` | `9 disabled, unknown, detached, unexposed or read-only target` |
| `E_TIMEOUT` | `6 request timeout` |
| `E_GONE` | `6 surface disconnected with requests pending` |
| `E_BUSY` | `5 more than 16 pending handshakes; 8 attach in flight, more than 32 grants on a surface; 9 prompt up (chat.say and chat.status included), a permission that changed while the request waited; 12 prompts; 13 capacity, a peer that does not read` |
| `E_INTERNAL` | `9 handler threw, result not JSON; 13 audit unavailable` |

Generated by `conformance/tools/make-vectors.mjs` from the formulas in the specification, with `node:crypto` only.
