> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-mintlify-3a82795f.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> 包含各错误代码及其触发次数的系统表。

# system.errors

<Info>
  **在 ClickHouse Cloud 中查询**

  此系统表中的数据分别保存在 ClickHouse Cloud 各节点的本地。因此，如需查看所有数据的完整情况，需要使用 `clusterAllReplicas` 函数。更多详情请参见[此处](/zh/reference/system-tables/overview#system-tables-in-clickhouse-cloud)。
</Info>

<div id="description">
  ## 描述
</div>

包含错误代码及其触发次数。

若要显示所有可能的错误代码 (包括未触发的错误代码) ，请将设置 [system\_events\_show\_zero\_values](/zh/reference/settings/session-settings#system_events_show_zero_values) 设为 1。

<div id="columns">
  ## 列
</div>

* `name` ([String](/zh/reference/data-types)) — 错误名称 (errorCodeToName) 。
* `code` ([Int32](/zh/reference/data-types)) — 错误代码编号。
* `value` ([UInt64](/zh/reference/data-types)) — 此错误发生的次数。
* `last_error_time` ([DateTime](/zh/reference/data-types)) — 最近一次发生错误的时间。
* `last_error_message` ([String](/zh/reference/data-types)) — 最近一次错误的消息。
* `last_error_format_string` ([String](/zh/reference/data-types)) — 最近一次错误的格式字符串。
* `last_error_trace` ([Array(UInt64)](/zh/reference/data-types)) — 堆栈跟踪，表示已调用方法所在物理地址的列表。
* `remote` ([UInt8](/zh/reference/data-types)) — 远程异常 (即在某次分布式查询期间接收到的异常) 。
* `query_id` ([String](/zh/reference/data-types)) — 导致错误的查询 ID (如果可用) 。

<Note>
  某些错误的计数器即使在查询成功执行时也可能增加。除非你能确定相应错误不可能是误报，否则不建议将此表用于服务器监控。
</Note>

<div id="example">
  ## 示例
</div>

```sql title="Query" theme={null}
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" theme={null}
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
```
