Files

63 lines
3.3 KiB
Plaintext

---
description: 'System table containing error codes with the number of times they have
been triggered.'
keywords: ['system table', 'errors']
slug: /operations/system-tables/errors
title: 'system.errors'
doc_type: 'reference'
---
import SystemTableCloud from '/snippets/_system_table_cloud.mdx';
<SystemTableCloud/>
{/*AUTOGENERATED_START*/}
## Description {#description}
Contains error codes with the number of times they have been triggered.
To show all possible error codes, including ones which were not triggered, set setting [system_events_show_zero_values](/reference/settings/session-settings/system#system_events_show_zero_values) to 1.
## Columns {#columns}
- `name` ([String](/reference/data-types/string)) — Name of the error (errorCodeToName).
- `code` ([Int32](/reference/data-types/int-uint)) — Code number of the error.
- `value` ([UInt64](/reference/data-types/int-uint)) — The number of times this error happened.
- `last_error_time` ([DateTime](/reference/data-types/datetime)) — The time when the last error happened.
- `last_error_message` ([String](/reference/data-types/string)) — Message for the last error.
- `last_error_format_string` ([String](/reference/data-types/string)) — Format string for the last error.
- `last_error_trace` ([Array(UInt64)](/reference/data-types/array)) — A stack trace of the last error. On ELF platforms except FreeBSD, addresses inside the main ClickHouse binary are stored as physical file offsets, and frames outside it (shared libraries, JIT code) are stored as 0.
- `remote` ([UInt8](/reference/data-types/int-uint)) — Remote exception (i.e. received during one of the distributed queries).
- `query_id` ([String](/reference/data-types/string)) — Id of a query that caused an error (if available).
- `last_error_symbols` ([Array(LowCardinality(String))](/reference/data-types/array)) — Demangled symbol names corresponding to last_error_trace.
- `last_error_lines` ([Array(LowCardinality(String))](/reference/data-types/array)) — File names with line numbers corresponding to last_error_trace.
Counters for some errors may increase during successful query execution. It's not recommended to use this table for server monitoring purposes unless you are sure that corresponding error can not be a false positive.
`last_error_symbols` and `last_error_lines` are resolved from the binary's symbol table and debug info.
`last_error_symbols` is populated wherever the symbol table is available (Linux and macOS builds).
`last_error_lines` additionally requires DWARF debug info - read directly from the binary on Linux, or from a co-located `.dSYM` bundle on macOS - so it is empty when that debug info is not available. Both arrays are empty on platforms without introspection support (for example FreeBSD).
## Example {#example}
```sql title="Query"
SELECT name, code, value
FROM system.errors
WHERE value > 0
ORDER BY code ASC
LIMIT 1
┌─name─────────────┬─code─┬─value─┐
│ CANNOT_OPEN_FILE │ 76 │ 1 │
└──────────────────┴──────┴───────┘
```
```sql title="Response"
WITH arrayMap(x -> demangle(addressToSymbol(x)), last_error_trace) AS all
SELECT name, arrayStringConcat(all, '\n') AS res
FROM system.errors
LIMIT 1
SETTINGS allow_introspection_functions=1\G
```
{/*AUTOGENERATED_END*/}