Skip to main content
system.errors has one counter per error code, and a counter is incremented when the server raises an exception with that code. The table does not know whether the exception later failed a query or was caught and handled inside the server. A non-zero counter therefore does not mean that a query failed. To find queries that failed, use system.query_log.

Example: a skipped row

The input_format_allow_errors_num setting lets a query skip rows that cannot be parsed. The second row below has text where a number is expected:
The query succeeds and returns the two valid rows. The parser still raised an exception for the bad row before the row was skipped, and system.errors counted it:
The query_id column of system.errors holds the query that raised the last exception of each kind. Joining it with system.query_log shows that this query finished without an exception:

Example: format detection

Some features work by trying an operation and handling the failure. When you do not name the format of the data, ClickHouse detects the format by trying the candidates one after another. Each attempt that does not fit raises an exception inside the server:
On a freshly started test instance that ran only the two queries of this article, the table now contains four error codes, although no query failed (the exact list depends on the version):

Where the errors come from

The counters are server-wide and cumulative since the server started. They include:
  • exceptions that the server raises and handles while a query succeeds, as in the examples above;
  • exceptions of background operations, for example a mutation that fails and is retried, which happen outside of any query;
  • failed queries of every user and application, including the ones that a client retried successfully;
  • exceptions received from other servers during distributed queries, counted in separate rows with remote = 1.
Where the data is parsed also matters, and for clickhouse-client it depends on the insert:
  • Data that follows the query text (INSERT ... FORMAT CSV with the rows after it, or INSERT ... VALUES) is sent to the server as text when the insert is asynchronous (async_insert = 1, the default since ClickHouse 26.2) or when the client runs with --inline-insert-data. The server parses it and counts the parsing exceptions, and the client reports the error as Received exception from server.
  • Data of a synchronous insert (async_insert = 0), and data that the client reads from standard input or with FROM INFILE, is parsed by the client. These parsing errors are reported as Error on processing query and never reach the server.
Over the HTTP interface the server parses the data, and its parsing exceptions are counted on the server.
Before ClickHouse 26.8, an ordinary INSERT ... VALUES could increment parse error counters such as CANNOT_PARSE_INPUT_ASSERTION_FAILED: when the fast parser of the Values format could not read a value, the value was parsed again as an SQL expression, and the failed first attempt was counted although the insert succeeded. Starting with 26.8 these attempts are no longer counted.

How to find real failures

Queries that failed are in system.query_log with the type ExceptionBeforeStart or ExceptionWhileProcessing:
Use system.errors, and its history in system.error_log, as a hint that something happens on the server, and alert on a counter only if you know that the error code cannot be raised during normal operation. The reference page of system.errors gives the same advice.