# Error codes

## Error response

Failures include a CoordinatorDB number, symbolic name and operation-specific
message. The same identifier appears in the native response, CLI diagnostic and
query log. Successful query-log events use zero and an empty exception.

```text
Code: 1002. CoordinatorDB::Exception: no such table: users (UNKNOWN_TABLE)
```

## Identifying a failure

These numbers are independent of SQLite result codes and ClickHouse error codes.
Messages can include object names and other details; use the number or symbolic
name to identify the failure. The embedded API exposes code(), name(),
error_code() and message(); primary_code() exposes the separate SQLite-compatible
result code.

HTTP errors include X-Coordinator-Exception-Code. An HTTP status groups transport
and SQL failures and does not replace the database error identifier. See the
[HTTP interface](https://coordinatordb.com/docs/concepts/features/interfaces/http) for status mapping.

## Registry

| Code | Name                                |
| ---- | ----------------------------------- |
| 1000 | `SQL_ERROR`                         |
| 1001 | `SYNTAX_ERROR`                      |
| 1002 | `UNKNOWN_TABLE`                     |
| 1003 | `UNKNOWN_COLUMN`                    |
| 1004 | `UNKNOWN_DATABASE`                  |
| 1005 | `UNKNOWN_INDEX`                     |
| 1006 | `UNKNOWN_VIEW`                      |
| 1007 | `UNKNOWN_TRIGGER`                   |
| 1008 | `UNKNOWN_FUNCTION`                  |
| 1009 | `UNKNOWN_COLLATION`                 |
| 1010 | `OBJECT_ALREADY_EXISTS`             |
| 1011 | `AMBIGUOUS_COLUMN`                  |
| 1012 | `INVALID_ARGUMENT`                  |
| 1013 | `UNSUPPORTED_FEATURE`               |
| 1014 | `INVALID_TRANSACTION_STATE`         |
| 1015 | `UNKNOWN_SAVEPOINT`                 |
| 1016 | `NO_DATABASE_SELECTED`              |
| 1017 | `READ_ONLY`                         |
| 1018 | `TYPE_MISMATCH`                     |
| 1019 | `NUMERIC_OVERFLOW`                  |
| 1020 | `SCHEMA_CHANGED`                    |
| 1021 | `STRING_TOO_LONG`                   |
| 1022 | `UNKNOWN_FORMAT`                    |
| 1023 | `FORMAT_IS_NOT_SUITABLE_FOR_INPUT`  |
| 1024 | `FORMAT_IS_NOT_SUITABLE_FOR_OUTPUT` |
| 1025 | `INCORRECT_DATA`                    |
| 1026 | `DUPLICATE_JSON_KEY`                |
| 2000 | `FORMAT_ERROR`                      |
| 3000 | `IO_ERROR`                          |
| 3001 | `DATABASE_LOCKED`                   |
| 4000 | `CONSTRAINT_VIOLATION`              |
| 4001 | `PRIMARY_KEY_VIOLATION`             |
| 4002 | `UNIQUE_VIOLATION`                  |
| 4003 | `NOT_NULL_VIOLATION`                |
| 4004 | `CHECK_VIOLATION`                   |
| 4005 | `FOREIGN_KEY_VIOLATION`             |
| 4006 | `ROWID_VIOLATION`                   |
| 4007 | `TRIGGER_VIOLATION`                 |
| 5000 | `UNKNOWN_ERROR`                     |
| 5001 | `PROTOCOL_ERROR`                    |
| 5002 | `CONFIGURATION_ERROR`               |
| 5003 | `RESPONSE_TOO_LARGE`                |
| 5004 | `INTERNAL_ERROR`                    |
| 5005 | `AUTHENTICATION_FAILED`             |
| 6000 | `QUERY_TIME_LIMIT_EXCEEDED`         |
| 6001 | `QUERY_MEMORY_LIMIT_EXCEEDED`       |
| 6002 | `RESULT_ROWS_LIMIT_EXCEEDED`        |
| 6003 | `RESULT_BYTES_LIMIT_EXCEEDED`       |
| 6004 | `CONNECTION_LIMIT_EXCEEDED`         |
| 6005 | `REQUEST_MEMORY_LIMIT_EXCEEDED`     |
| 6006 | `REQUEST_READ_TIMEOUT`              |

## Related contracts

Resource errors distinguish query time, accounted query memory, returned rows, encoded bytes, connection admission and incoming request memory. Use the permanent identifier to select the relevant limit; the message supplies details for the failing operation.

See [request limits](https://coordinatordb.com/docs/concepts/features/configuration/settings/query-complexity), [HTTP responses](https://coordinatordb.com/docs/concepts/features/interfaces/http#status-codes) and [query_log](https://coordinatordb.com/docs/reference/system-tables/query-log).
