# ClickHouse error codes

> Every common ClickHouse error code from system.errors, with the exception text you see and full write-ups of code 62, 241, 516 and more.

Source: https://sqlly.app/errors/clickhouse
Last updated: 2026-11-30
License: Text and data [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/) (credit SQLly, sqlly.app); code and SQL snippets [MIT](https://opensource.org/license/mit). [Details](https://sqlly.app/license).
Note: Quoted error message text belongs to its database vendor.

ClickHouse numbers its errors with integer codes. The server records how often each one fired in `system.errors`, and a failed query returns the code in the exception text, in the HTTP body, or through the client driver. The ones you are likely to meet have a full page with causes and fixes.

## Reading a ClickHouse error

Each error has a numeric code, such as 62 for `SYNTAX_ERROR` or 241 for `MEMORY_LIMIT_EXCEEDED`. The full list lives in the ClickHouse source and changes between releases.

The code reaches you in the exception text (`DB::Exception: ... (version ...) , code: 62`), in the `X-ClickHouse-Exception-Code` HTTP header and response body, or as a driver exception code.

Run `SELECT name, code FROM system.errors` to list every code the server knows, and `SELECT name, last_error_time, last_error_message FROM system.errors WHERE value > 0` to see which ones actually fired.

`system.query_log` keeps the failed query text and exception per query, which is usually faster than guessing from the code alone.

## Syntax and parsing

- `46` (UNKNOWN_FUNCTION): Unknown function {function}
- `63` (UNKNOWN_AGGREGATE_FUNCTION): Unknown aggregate function {function}
- `42` (NUMBER_OF_ARGUMENTS_DOESNT_MATCH): Number of arguments doesn't match: passed {passed}, should be {expected}
- `34` (TOO_MANY_ARGUMENTS_FOR_FUNCTION): Too many arguments for function {function}
- `35` (TOO_FEW_ARGUMENTS_FOR_FUNCTION): Too few arguments for function {function}
- `80` (INCORRECT_QUERY): Incorrect query: {reason}
- `211` (EMPTY_QUERY): Empty query
- `207` (AMBIGUOUS_IDENTIFIER): Ambiguous column {column}
- `206` (ALIAS_REQUIRED): Alias {alias} is required
- `179` (MULTIPLE_EXPRESSIONS_FOR_ALIAS): Multiple expressions for alias {alias}
- `174` (CYCLIC_ALIASES): Cyclic aliases: {aliases}
- `183` (UNEXPECTED_EXPRESSION): Unexpected expression {expression}
- `162` (TOO_DEEP_SUBQUERIES): Too deep subqueries. Maximum: {max_depth}
- `1` (UNSUPPORTED_METHOD): Method is not supported
- `2` (UNSUPPORTED_PARAMETER): Parameter {parameter} is not supported
- [`47`](https://sqlly.app/errors/clickhouse/unknown-identifier) (UNKNOWN_IDENTIFIER): UNKNOWN_IDENTIFIER (code 47)
- [`62`](https://sqlly.app/errors/clickhouse/syntax-error) (SYNTAX_ERROR): SYNTAX_ERROR (code 62)

## Query execution

- `48` (NOT_IMPLEMENTED): Method is not supported by {what}
- `36` (BAD_ARGUMENTS): Bad arguments: {reason}
- `49` (LOGICAL_ERROR): Logical error: {reason}
- `108` (NO_DATA_TO_INSERT): No data to insert
- `349` (CANNOT_INSERT_NULL_IN_ORDINARY_COLUMN): Cannot insert NULL value into a column that is not Nullable
- `389` (INSERT_WAS_DEDUPLICATED): Block with ID {id} already exists, ignoring it
- `407` (DECIMAL_OVERFLOW): Decimal overflow while converting to Decimal({precision}, {scale})
- `153` (ILLEGAL_DIVISION): Division by zero
- `216` (QUERY_WITH_SAME_ID_IS_ALREADY_RUNNING): Query with id = {query_id} is already running
- `394` (QUERY_WAS_CANCELLED): Query was cancelled
- `392` (QUERY_IS_PROHIBITED): Query is prohibited: {reason}
- `620` (QUERY_NOT_ALLOWED): Query is not allowed in {scope}
- `264` (INCOMPATIBLE_TYPE_OF_JOIN): Incompatible type of join
- `418` (UNKNOWN_JOIN): Unknown join {join}
- `403` (INVALID_JOIN_ON_EXPRESSION): Invalid JOIN ON expression
- `258` (UNION_ALL_RESULT_STRUCTURES_MISMATCH): UNION ALL result structures do not match
- `596` (INTERSECT_OR_EXCEPT_RESULT_STRUCTURES_MISMATCH): INTERSECT or EXCEPT result structures do not match
- `181` (ILLEGAL_FINAL): FINAL modifier is not supported for {table}
- `182` (ILLEGAL_PREWHERE): PREWHERE is not supported for {table}
- `319` (UNKNOWN_STATUS_OF_INSERT): Unknown status of insert, client must retry
- `380` (CANNOT_KILL): Cannot kill. {reason}
- `398` (UNKNOWN_MUTATION_COMMAND): Unknown mutation command {command}
- `692` (TOO_MANY_MUTATIONS): Too many mutations: {count}
- `582` (NO_SUCH_PROJECTION_IN_TABLE): No such projection {projection} in table
- `583` (ILLEGAL_PROJECTION): Illegal projection {projection}. {reason}
- `471` (INVALID_SETTING_VALUE): Invalid setting value {value} for setting {setting}
- `472` (READONLY_SETTING): Cannot modify read-only setting {setting}
- `452` (SETTING_CONSTRAINT_VIOLATION): Setting {setting} should not be changed: {reason}
- `456` (UNKNOWN_QUERY_PARAMETER): Unknown query parameter {parameter}
- `457` (BAD_QUERY_PARAMETER): Bad query parameter: {reason}
- `341` (UNFINISHED): Unfinished
- `1001` (STD_EXCEPTION): Standard library exception: {message}
- `1002` (UNKNOWN_EXCEPTION): Unknown exception: {message}
- `649` (INVALID_TRANSACTION): Invalid transaction: {reason}
- `659` (UNKNOWN_STATUS_OF_TRANSACTION): Unknown status of transaction
- `1004` (STARTUP_SCRIPTS_ERROR): Startup scripts error: {message}
- `1006` (INVALID_CURSOR_LOOKUP): Invalid cursor lookup
- `1007` (ILLEGAL_STREAM): Illegal stream

## Tables, columns and metadata

- `81` (UNKNOWN_DATABASE): Database {database} does not exist
- `82` (DATABASE_ALREADY_EXISTS): Database {database} already exists
- `50` (UNKNOWN_TYPE): Unknown data type {type}
- [`16`](https://sqlly.app/errors/clickhouse/no-such-column-in-table) (NO_SUCH_COLUMN_IN_TABLE): NO_SUCH_COLUMN_IN_TABLE (code 16)
- `15` (DUPLICATE_COLUMN): Column {column} already exists
- `43` (ILLEGAL_TYPE_OF_ARGUMENT): Illegal type {type} of argument {argument} of function {function}
- `44` (ILLEGAL_COLUMN): Illegal column {column} of argument of function {function}
- `56` (UNKNOWN_STORAGE): Unknown table engine {engine}
- `336` (UNKNOWN_DATABASE_ENGINE): Unknown database engine {engine}
- `218` (TABLE_IS_DROPPED): Table {database}.{table} is dropped or being dropped
- `219` (DATABASE_NOT_EMPTY): Database {database} is not empty
- `256` (PARTITION_ALREADY_EXISTS): Partition {partition} already exists
- `257` (PARTITION_DOESNT_EXIST): Partition {partition} does not exist
- `248` (INVALID_PARTITION_VALUE): Invalid partition value: {value}
- `504` (FILE_ALREADY_EXISTS): File {file} already exists
- `70` (CANNOT_CONVERT_TYPE): Cannot convert {from_type} to {to_type}
- `386` (NO_COMMON_TYPE): There is no supertype for types {left_type}, {right_type}
- `342` (METADATA_MISMATCH): Metadata mismatch: {reason}
- `345` (TABLE_DIFFERS_TOO_MUCH): Tables differ too much: {reason}
- `390` (CANNOT_GET_CREATE_TABLE_QUERY): Cannot get create table query: {reason}
- `517` (CANNOT_ASSIGN_ALTER): Cannot assign ALTER: {reason}
- `420` (CANNOT_UPDATE_COLUMN): Cannot UPDATE: {reason}
- `609` (FUNCTION_ALREADY_EXISTS): Function {function} already exists
- `610` (CANNOT_DROP_FUNCTION): Cannot drop function {function}: {reason}
- `281` (DICTIONARY_IS_EMPTY): Dictionary {dictionary} is empty
- `387` (DICTIONARY_ALREADY_EXISTS): Dictionary {dictionary} already exists
- `489` (INCORRECT_DICTIONARY_DEFINITION): Incorrect dictionary definition: {reason}
- `478` (UNKNOWN_POLICY): Unknown storage policy {policy}
- `479` (UNKNOWN_DISK): Unknown disk {disk}
- [`57`](https://sqlly.app/errors/clickhouse/table-already-exists) (TABLE_ALREADY_EXISTS): TABLE_ALREADY_EXISTS (code 57)
- [`60`](https://sqlly.app/errors/clickhouse/table-not-exists) (UNKNOWN_TABLE): UNKNOWN_TABLE (code 60)
- [`53`](https://sqlly.app/errors/clickhouse/type-mismatch) (TYPE_MISMATCH): TYPE_MISMATCH (code 53)

## Formats and input data

- `7` (INCORRECT_NUMBER_OF_COLUMNS): Incorrect number of columns
- `8` (THERE_IS_NO_COLUMN): There is no column {column} in input
- `9` (SIZES_OF_COLUMNS_DOESNT_MATCH): Sizes of columns don't match
- [`20`](https://sqlly.app/errors/clickhouse/number-of-columns-doesnt-match) (NUMBER_OF_COLUMNS_DOESNT_MATCH): NUMBER_OF_COLUMNS_DOESNT_MATCH (code 20)
- `3` (UNEXPECTED_END_OF_FILE): Unexpected end of file while reading {what}
- `4` (EXPECTED_END_OF_FILE): Expected end of file
- `6` (CANNOT_PARSE_TEXT): Cannot parse input: expected {expected} before {found}
- `27` (CANNOT_PARSE_INPUT_ASSERTION_FAILED): Cannot parse input: assertion failed
- `32` (ATTEMPT_TO_READ_AFTER_EOF): Attempt to read after EOF
- `33` (CANNOT_READ_ALL_DATA): Cannot read all data. Bytes read: {read}. Bytes expected: {expected}
- `38` (CANNOT_PARSE_DATE): Cannot parse date from string {value}
- `41` (CANNOT_PARSE_DATETIME): Cannot parse DateTime from string {value}
- `72` (CANNOT_PARSE_NUMBER): Cannot parse number from string {value}
- `632` (UNEXPECTED_DATA_AFTER_PARSED_VALUE): Unexpected data after parsed value: {data}
- `85` (FORMAT_IS_NOT_SUITABLE_FOR_INPUT): Format {format} is not suitable for input
- `399` (FORMAT_IS_NOT_SUITABLE_FOR_OUTPUT): Format {format} is not suitable for output
- `73` (UNKNOWN_FORMAT): Unknown format {format}
- `578` (INVALID_FORMAT_INSERT_QUERY_WITH_DATA): Invalid format of INSERT query with data
- `536` (CANNOT_RESTORE_FROM_FIELD_DUMP): Cannot restore data from field dump: {reason}
- `434` (CANNOT_PARSE_PROTOBUF_SCHEMA): Cannot parse Protobuf schema: {reason}
- `474` (INVALID_TEMPLATE_FORMAT): Invalid template format: {reason}

## Resource limits

- `158` (TOO_MANY_ROWS): Limit for rows to read exceeded: read {read} rows
- `396` (TOO_MANY_ROWS_OR_BYTES): Limit for result or intermediate data exceeded: read {rows} rows, {bytes} bytes
- `191` (SET_SIZE_LIMIT_EXCEEDED): Set size limit exceeded
- `160` (TOO_SLOW): Query is executing too slowly. Must process at least {rows_per_second} rows per second or {bytes_per_second} bytes per second
- `161` (TOO_MANY_COLUMNS): Too many columns. Maximum: {max_columns}
- `165` (TOO_MANY_TEMPORARY_COLUMNS): Too many temporary columns. Maximum: {max_columns}
- `166` (TOO_MANY_TEMPORARY_NON_CONST_COLUMNS): Too many temporary non-constant columns. Maximum: {max_columns}
- `201` (QUOTA_EXCEEDED): Quota for user {user} in default interval exceeded
- [`243`](https://sqlly.app/errors/clickhouse/not-enough-space) (NOT_ENOUGH_SPACE): NOT_ENOUGH_SPACE (code 243)
- [`252`](https://sqlly.app/errors/clickhouse/too-many-parts) (TOO_MANY_PARTS): TOO_MANY_PARTS (code 252)
- `565` (TOO_MANY_PARTITIONS): Too many partitions in single INSERT. Maximum: {max_partitions}
- `307` (TOO_MANY_BYTES): Limit for bytes to read exceeded: read {read} bytes
- `290` (LIMIT_EXCEEDED): Limit {name} exceeded
- `473` (DEADLOCK_AVOIDED): Deadlock avoided
- `439` (CANNOT_SCHEDULE_TASK): Cannot schedule a task: {reason}
- `173` (CANNOT_ALLOCATE_MEMORY): Cannot allocate memory: {reason}
- [`241`](https://sqlly.app/errors/clickhouse/memory-limit-exceeded) (MEMORY_LIMIT_EXCEEDED): MEMORY_LIMIT_EXCEEDED (code 241)
- [`242`](https://sqlly.app/errors/clickhouse/table-is-read-only) (TABLE_IS_READ_ONLY): TABLE_IS_READ_ONLY (code 242)
- [`159`](https://sqlly.app/errors/clickhouse/timeout-exceeded) (TIMEOUT_EXCEEDED): TIMEOUT_EXCEEDED (code 159)
- [`202`](https://sqlly.app/errors/clickhouse/too-many-simultaneous-queries) (TOO_MANY_SIMULTANEOUS_QUERIES): TOO_MANY_SIMULTANEOUS_QUERIES (code 202)

## Authentication and access

- `700` (USER_SESSION_LIMIT_EXCEEDED): Connection limit exceeded for user {user}
- [`164`](https://sqlly.app/errors/clickhouse/readonly) (READONLY): READONLY (code 164)
- `497` (ACCESS_DENIED): {user}: Access denied: {access}
- `192` (UNKNOWN_USER): Unknown user {user}
- `193` (WRONG_PASSWORD): Wrong password for user {user}
- `194` (REQUIRED_PASSWORD): Password required for user {user}
- `195` (IP_ADDRESS_NOT_ALLOWED): User {user} is not allowed connect from address {address}
- `492` (ACCESS_ENTITY_NOT_FOUND): Access entity {name} not found
- `493` (ACCESS_ENTITY_ALREADY_EXISTS): Access entity {name} already exists
- `509` (INVALID_GRANT): Invalid grant: {reason}
- `511` (UNKNOWN_ROLE): Unknown role {role}
- `512` (SET_NON_GRANTED_ROLE): Role {role} is not granted to user {user}
- `508` (UNKNOWN_ACCESS_TYPE): Unknown access type {access}
- `291` (DATABASE_ACCESS_DENIED): {user}: Access denied to database {database}
- `481` (PATH_ACCESS_DENIED): Path {path} is not allowed
- `372` (SESSION_NOT_FOUND): Session {session} not found
- `373` (SESSION_IS_LOCKED): Session {session} is locked by a concurrent client
- `495` (ACCESS_STORAGE_READONLY): Cannot modify access entities: access storage is read-only
- `496` (QUOTA_REQUIRES_CLIENT_KEY): Quota requires client certificate key to be set
- [`516`](https://sqlly.app/errors/clickhouse/authentication-failed) (AUTHENTICATION_FAILED): AUTHENTICATION_FAILED (code 516)

## Network and distributed queries

- `209` (SOCKET_TIMEOUT): Timeout exceeded while reading from socket ({address})
- `210` (NETWORK_ERROR): Network error: {reason}
- `95` (CANNOT_READ_FROM_SOCKET): Cannot read from socket ({address})
- `96` (CANNOT_WRITE_TO_SOCKET): Cannot write to socket ({address})
- `279` (ALL_CONNECTION_TRIES_FAILED): All tries to get connection to ({addresses}) failed
- `519` (NO_REMOTE_SHARD_AVAILABLE): No remote shard available
- `265` (NO_AVAILABLE_REPLICA): No available replica for table {table}
- `297` (SHARD_HAS_NO_CONNECTIONS): Shard {shard} has no connections
- `86` (RECEIVED_ERROR_FROM_REMOTE_IO_SERVER): Received error from remote IO server: {error}
- `410` (EXTERNAL_SERVER_IS_NOT_RESPONDING): External server is not responding: {address}
- `198` (DNS_ERROR): DNS error: {reason}
- `904` (TOO_MANY_UNAVAILABLE_SHARDS): Too many unavailable shards. Shards, that are unavailable: {shards}
- `581` (TOO_LARGE_DISTRIBUTED_DEPTH): Maximum distributed depth exceeded: {depth}
- `1000` (POCO_EXCEPTION): Poco exception: {message}
- `1003` (SSH_EXCEPTION): SSH exception: {message}
- `280` (NO_AVAILABLE_DATA): No available data
- `203` (NO_FREE_CONNECTION): No free connection. Currently active connections: {count}

## Replication and ZooKeeper

- `225` (NO_ZOOKEEPER): Table is Replicated, but ZooKeeper is not enabled
- `226` (NO_FILE_IN_DATA_PART): No file {file} in data part {part}
- `227` (UNEXPECTED_FILE_IN_DATA_PART): Unexpected file {file} in data part {part}
- `232` (NO_SUCH_DATA_PART): No data part {part}
- `234` (NO_REPLICA_HAS_PART): No replica has part {part} covering {range}
- `235` (DUPLICATE_DATA_PART): Data part {part} already exists
- `244` (UNEXPECTED_ZOOKEEPER_ERROR): Unexpected ZooKeeper error: {error}
- `251` (NO_SUCH_REPLICA): Replica {replica} is not found in ZooKeeper
- `253` (REPLICA_ALREADY_EXISTS): Replica {replica} already exists
- `254` (NO_ACTIVE_REPLICAS): No active replicas for table {table}
- `286` (UNSATISFIED_QUORUM_FOR_PREVIOUS_WRITE): Quorum for previous write has not been satisfied yet
- `289` (REPLICA_IS_NOT_IN_QUORUM): Replica {replica} is not in quorum
- `369` (ALL_REPLICAS_ARE_STALE): All replicas for table {table} are stale
- `415` (ALL_REPLICAS_LOST): All replicas lost. Waiting for {part}
- `416` (REPLICA_STATUS_CHANGED): Replica status changed: {reason}
- `224` (REPLICA_IS_ALREADY_ACTIVE): Replica {replica} is already active
- `285` (TOO_FEW_LIVE_REPLICAS): Too few live replicas: {count} of {total}
- `567` (DUPLICATED_PART_UUIDS): Table {database}.{table} has part with UUID {uuid} that is already presented on another replica
- `246` (CORRUPTED_DATA): Corrupted data
- `513` (UNKNOWN_PART_TYPE): Unknown or unsupported part type {type}
- `999` (KEEPER_EXCEPTION): Keeper exception: {message}
- `571` (DATABASE_REPLICATION_FAILED): Database replication failed: {reason}
- `593` (ZERO_COPY_REPLICATION_ERROR): Zero copy replication error: {reason}
- `568` (RAFT_ERROR): Raft error: {reason}

## Integrations and external systems

- `538` (MYSQL_SYNTAX_ERROR): MySQL syntax error: {error}
- `614` (POSTGRESQL_CONNECTION_FAILURE): PostgreSQL connection failure: {error}
- `499` (S3_ERROR): S3 error: {code} ({message})
- `500` (AZURE_BLOB_STORAGE_ERROR): Azure Blob Storage error: {message}
- `660` (HDFS_ERROR): HDFS error: {message}
- `693` (AWS_ERROR): AWS SDK error: {message}
- `634` (MONGODB_ERROR): MongoDB error: {message}
- `591` (SQLITE_ENGINE_ERROR): SQLite engine error: {message}
- `555` (ROCKSDB_ERROR): RocksDB error: {message}
- `391` (EXTERNAL_LIBRARY_ERROR): External library error: {message}
- `484` (INTERNAL_REDIS_ERROR): Internal Redis error: {message}
- `640` (NO_HIVEMETASTORE): No Hive Metastore connection
- `422` (UNSUPPORTED_URI_SCHEME): Unsupported URI scheme {scheme}
- `491` (UNACCEPTABLE_URL): Unacceptable URL {url}
- `483` (TOO_MANY_REDIRECTS): Too many redirects
- `539` (CANNOT_BIND_RABBITMQ_EXCHANGE): Cannot bind RabbitMQ exchange
- `598` (BACKUP_ALREADY_EXISTS): Backup {name} already exists
- `599` (BACKUP_NOT_FOUND): Backup {name} not found
- `607` (CANNOT_RESTORE_DATABASE): Cannot restore database {database}: {reason}
- `608` (CANNOT_RESTORE_TABLE): Cannot restore table {table}: {reason}
- `293` (MONGODB_CANNOT_AUTHENTICATE): Cannot authenticate in MongoDB
- `1005` (STALE_VERSION): Stale version
- `619` (POSTGRESQL_REPLICATION_INTERNAL_ERROR): PostgreSQL replication internal error: {reason}

Codes and messages are from the [ClickHouse documentation (system.errors)](https://clickhouse.com/docs/en/operations/system-tables/errors).
