219| `Cloud sessions use your claude.ai login`,出现在指明某个凭据的策略拒绝消息末尾 | [命令行错误](#cloud-sessions-use-your-claude-ai-login) |219| `Cloud sessions use your claude.ai login`,出现在指明某个凭据的策略拒绝消息末尾 | [命令行错误](#cloud-sessions-use-your-claude-ai-login) |
220| `Couldn't verify your organization's policy for cloud sessions` | [命令行错误](#couldnt-verify-your-organizations-policy-for-cloud-sessions) |220| `Couldn't verify your organization's policy for cloud sessions` | [命令行错误](#couldnt-verify-your-organizations-policy-for-cloud-sessions) |
221| `Cloud sessions aren't available:`,后跟无法加载您组织策略的原因 | [命令行错误](#couldnt-verify-your-organizations-policy-for-cloud-sessions) |221| `Cloud sessions aren't available:`,后跟无法加载您组织策略的原因 | [命令行错误](#couldnt-verify-your-organizations-policy-for-cloud-sessions) |
222| `Cloud sessions aren't available with this Console sign-in. They need a claude.ai sign-in.` | [无法获取组织 UUID](https://code.claude.com/docs/zh-CN/claude-code-on-the-web.md#unable-to-get-organization-uuid) |
222| `Cloud sessions need a claude.ai sign-in` | [无法获取组织 UUID](https://code.claude.com/docs/zh-CN/claude-code-on-the-web.md#unable-to-get-organization-uuid) |223| `Cloud sessions need a claude.ai sign-in` | [无法获取组织 UUID](https://code.claude.com/docs/zh-CN/claude-code-on-the-web.md#unable-to-get-organization-uuid) |
223| `Nothing was stashed: "<path>" is now a folder in place of a tracked file or link` / `are now folders in place of tracked files or links` | [命令行错误](#nothing-was-stashed-because-a-folder-replaced-a-tracked-file) |224| `Nothing was stashed: "<path>" is now a folder in place of a tracked file or link` / `are now folders in place of tracked files or links` | [命令行错误](#nothing-was-stashed-because-a-folder-replaced-a-tracked-file) |
224| `Error: --json-schema is not a valid JSON Schema` | [命令行错误](#the-json-schema-value-is-not-a-valid-json-schema) |225| `Error: --json-schema is not a valid JSON Schema` | [命令行错误](#the-json-schema-value-is-not-a-valid-json-schema) |
325| `File is covered by a Read deny rule in your permission settings` | [工具错误](#file-is-covered-by-a-read-deny-rule) |326| `File is covered by a Read deny rule in your permission settings` | [工具错误](#file-is-covered-by-a-read-deny-rule) |
326| `cannot contain null bytes (\0)` | [工具错误](#path-cannot-contain-null-bytes) |327| `cannot contain null bytes (\0)` | [工具错误](#path-cannot-contain-null-bytes) |
327| `Path contains null bytes` | [工具错误](#path-cannot-contain-null-bytes) |328| `Path contains null bytes` | [工具错误](#path-cannot-contain-null-bytes) |
329| `command contains the invisible character U+FEFF (byte order mark) or U+180E (Mongolian vowel separator), and was not run` | [工具错误](#command-contains-an-invisible-character) |
328| `File is too large to read as an image (the limit is 128MB)` | [工具错误](#file-is-too-large-to-read-as-an-image) |330| `File is too large to read as an image (the limit is 128MB)` | [工具错误](#file-is-too-large-to-read-as-an-image) |
329| `Cannot read this as an image: <path> is a pipe or a device` | [工具错误](#file-is-too-large-to-read-as-an-image) |331| `Cannot read this as an image: <path> is a pipe or a device` | [工具错误](#file-is-too-large-to-read-as-an-image) |
330| `subagent_type is required: the general-purpose agent is not available in this session` | [工具错误](#subagent-type-is-required) |332| `subagent_type is required: the general-purpose agent is not available in this session` | [工具错误](#subagent-type-is-required) |
397| `Claude Code process exited with code N` | [包装器和 IDE 错误](#claude-code-process-exited-with-code-n) |399| `Claude Code process exited with code N` | [包装器和 IDE 错误](#claude-code-process-exited-with-code-n) |
398| `The connection to Claude Code ended before this message completed` | [包装器和 IDE 错误](#the-connection-to-claude-code-ended-before-this-message-completed) |400| `The connection to Claude Code ended before this message completed` | [包装器和 IDE 错误](#the-connection-to-claude-code-ended-before-this-message-completed) |
399| `Could not locate the Claude CLI on PATH` | [包装器和 IDE 错误](#could-not-locate-the-claude-cli-on-path) |401| `Could not locate the Claude CLI on PATH` | [包装器和 IDE 错误](#could-not-locate-the-claude-cli-on-path) |
402| `The Claude Code program for this computer, the <build> build, could not be found` | [包装器和 IDE 错误](#the-claude-code-program-for-this-computer-could-not-be-found) |
400| `Restored the code, but skipped N files` | [Rewind 警告和错误](#restored-the-code-but-skipped-files) |403| `Restored the code, but skipped N files` | [Rewind 警告和错误](#restored-the-code-but-skipped-files) |
401| `No files were restored: N files failed (backup missing, or the file could not be updated)` | [Rewind 警告和错误](#no-files-were-restored) |404| `No files were restored: N files failed (backup missing, or the file could not be updated)` | [Rewind 警告和错误](#no-files-were-restored) |
402| `Transcript writes are failing (...)` | [会话保存警告](#transcript-writes-are-failing) |405| `Transcript writes are failing (...)` | [会话保存警告](#transcript-writes-are-failing) |
485 488
486从 v2.1.198 开始,通常的微调器提示在重试期间被抑制。一旦错误原因被揭示,如果故障是 529 过载,倒计时下方的行也命名了检查服务状态的位置:Anthropic API 上的 `status.claude.com`,或其他配置上的提供商或网关主机。489从 v2.1.198 开始,通常的微调器提示在重试期间被抑制。一旦错误原因被揭示,如果故障是 529 过载,倒计时下方的行也命名了检查服务状态的位置:Anthropic API 上的 `status.claude.com`,或其他配置上的提供商或网关主机。
487 490
488如果在请求仍然待处理时响应流上 20 秒内没有数据到达,微调器显示 `Waiting for API response · will retry in … · check your network`,然后任何重试都尚未开始。请求尚未失败:倒计时运行到 Claude Code 中止停滞连接的点。中止后,您看到的内容取决于响应已进行的距离:491#### Waiting for API response
492
493`Waiting for API response · will retry in … · check your network` 横幅表示 Claude Code 已等待至少 20 秒,但未收到某个请求的任何数据。请求尚未失败:倒计时运行到 Claude Code 中止停滞连接的点。如果发生中止:
489 494
490* 在 Claude 完成文本块或工具调用之前,或在完成思考之后开始一个,Claude Code 重试请求或以错误结束轮次。[Automatic retries](#automatic-retries) 说明它重试哪些停滞以及多少次。495* 在 Claude 完成文本块或工具调用之前,或在完成思考之后开始一个,Claude Code 重试请求或以错误结束轮次。[Automatic retries](#automatic-retries) 说明它重试哪些停滞以及多少次。
491* 在 Claude 完成文本块或工具调用之后,或在完成思考之后开始一个,但在 Claude 完成响应之前,Claude Code 保留 Claude 完成的内容,从 Claude 完成的任何工具调用继续轮次,并显示 [The response above may be incomplete](#the-response-above-may-be-incomplete)。在非交互式会话中,以及对于任何会话中的子代理响应,Claude Code 可能首先提示 Claude 继续响应;该条目说明何时执行以及何时您仍然在那里看到通知。496* 在 Claude 完成文本块或工具调用之后,或在完成思考之后开始一个,但在 Claude 完成响应之前,Claude Code 保留 Claude 完成的内容,从 Claude 完成的任何工具调用继续轮次,并显示 [The response above may be incomplete](#the-response-above-may-be-incomplete)。在非交互式会话中,以及对于任何会话中的子代理响应,Claude Code 可能首先提示 Claude 继续响应;该条目说明何时执行以及何时您仍然在那里看到通知。
492* 在 Claude 完成响应之后,Claude Code 正常结束轮次。497* 在 Claude 完成响应之后,Claude Code 正常结束轮次。
493 498
494一旦数据恢复或重试成功,横幅会自动清除。如果它在每次尝试时重新出现,将其视为 [network issue](#unable-to-connect-to-api)。在 v2.1.185 之前,横幅在 10 秒后出现,措辞不同。499一旦数据恢复或重试成功,横幅会自动清除。如果它在每次尝试时重新出现,将其视为 [network issue](#unable-to-connect-to-api)。如果您通过网关连接,请参阅[通过网关连接时等待横幅时隐时现](#waiting-banner-behind-a-gateway)。在 v2.1.185 之前,横幅在 10 秒后出现,措辞不同。
495
496当 Claude 咨询 [advisor](https://code.claude.com/docs/zh-CN/advisor.md) 时,横幅在 90 秒无数据后出现,而不是 20 秒,因为长时间的顾问审查可能在远超 20 秒的时间内不发送任何数据。在 v2.1.214 之前,20 秒阈值也适用于顾问调用,所以横幅在顾问审查期间出现,即使没有任何问题。
497 500
498#### 通过网关连接时等待横幅时隐时现501#### 通过网关连接时等待横幅时隐时现
499 502
2495 2498
2496**要做什么:**2499**要做什么:**
2497 2500
2498* 如果您的 Claude Code 版本早于 v2.1.216,运行 `claude update`。2501* 如果您的 Claude Code 版本早于 v2.1.300,请在 shell 中运行 [`claude update`](https://code.claude.com/docs/zh-CN/setup#update-claude-code)。在 v2.1.300 之前,Claude Code 不会[在不带被拒绝工具参数的情况下重试请求](https://code.claude.com/docs/zh-CN/mcp.md#tools-whose-input-schema-the-api-refuses),因此每个包含该工具的请求都会重复出现此错误。
2499* 删除或[禁用](https://code.claude.com/docs/zh-CN/mcp.md#disable-a-server-without-removing-it)声明无效 schema 的 MCP 服务器。该错误仅按位置命名工具。在 v2.1.216 或更高版本上,检查每个服务器的日志,查找命名其输入 schema 会被拒绝的工具的行。如果没有日志命名一个,一次禁用一个服务器。2502* 删除或[禁用](https://code.claude.com/docs/zh-CN/mcp.md#disable-a-server-without-removing-it)声明无效 schema 的 MCP 服务器。该错误仅按位置命名工具。在 v2.1.216 或更高版本上,检查每个服务器的日志,查找命名其输入 schema 会被拒绝的工具的行。如果没有日志命名一个,一次禁用一个服务器。
2500* 如果您维护服务器,请修复工具的 `input_schema`。schema 必须是有效的 JSON Schema,顶级属性名称必须为 1 到 64 个字符长,并仅使用 ASCII 字母和数字、`_`、`.` 和 `-`。请参阅[具有无效输入 schema 的工具](https://code.claude.com/docs/zh-CN/mcp.md#tools-with-invalid-input-schemas)。2503* 如果您维护服务器,请修复工具的 `input_schema`。schema 必须是有效的 JSON Schema,顶级属性名称必须为 1 到 64 个字符长,并仅使用 ASCII 字母和数字、`_`、`.` 和 `-`。请参阅[具有无效输入 schema 的工具](https://code.claude.com/docs/zh-CN/mcp.md#tools-with-invalid-input-schemas)。
2501 2504
3295* **`Error: Workspace not trusted. <folder> is your home directory`**:由于主目录的信任从不保存,先在那里运行 `claude` 也无济于事。请改为在项目目录中运行 `claude ultrareview`(先在那里运行一次 `claude` 以接受信任对话框),或追加 `--trust-workspace`。3298* **`Error: Workspace not trusted. <folder> is your home directory`**:由于主目录的信任从不保存,先在那里运行 `claude` 也无济于事。请改为在项目目录中运行 `claude ultrareview`(先在那里运行一次 `claude` 以接受信任对话框),或追加 `--trust-workspace`。
3296* **`No answer in time.` 后跟 `Error: Workspace not trusted`**:`Trust <folder>? [y/N]` 问题在 5 分钟内未得到回答。再次运行 `claude ultrareview` 并回答该问题。3299* **`No answer in time.` 后跟 `Error: Workspace not trusted`**:`Trust <folder>? [y/N]` 问题在 5 分钟内未得到回答。再次运行 `claude ultrareview` 并回答该问题。
3297* **`Ultrareview did not start: <folder> is not trusted`**:您在 `Trust <folder>? [y/N]` 问题处拒绝了,例如回答 `n` 或按 Enter。若要开始审查,请再次运行 `claude ultrareview` 并回答 `y`。3300* **`Ultrareview did not start: <folder> is not trusted`**:您在 `Trust <folder>? [y/N]` 问题处拒绝了,例如回答 `n` 或按 Enter。若要开始审查,请再次运行 `claude ultrareview` 并回答 `y`。
3298* **``Ultrareview did not start: `--trust-workspace` takes no value``**:`--trust-workspace` 后面跟着的不是标志,例如 PR 编号或 `false`。如果您不信任该文件夹,请不要使用该标志。要在本次运行中信任它,请将 PR 编号或基础分支放在该标志之前:`claude ultrareview 1234 --trust-workspace`。3301* **``Ultrareview did not start: `--trust-workspace` takes no value``**:`--trust-workspace` 后面跟了非标志的内容,例如 PR 编号或 `false`。如果您不信任该文件夹,请省略此标志。要在本次运行中信任它,请将 PR 编号或基础分支放在该标志之前:`claude ultrareview 1234 --trust-workspace`。
3299 3302
3300在 v2.1.309 之前,`claude ultrareview` 不接受 `--trust-workspace`。3303在 v2.1.309 之前,`claude ultrareview` 不接受 `--trust-workspace`。
3301 3304
3587 3590
3588以下相关消息会在命令运行之前就出现:3591以下相关消息会在命令运行之前就出现:
3589 3592
3590* `Shell command permission check failed for pattern "..."`:命令的权限检查未允许其运行。[注入命令的权限检查](https://code.claude.com/docs/zh-CN/skills.md#permission-checks-on-injected-commands)介绍了在每种权限模式下哪些结果会导致中止,以及如何使用 `allowed-tools` 预先批准命令3593* `Shell command permission check failed for pattern "..."`:该命令的权限检查未允许其运行。[注入命令的权限检查](https://code.claude.com/docs/zh-CN/skills.md#permission-checks-on-injected-commands)介绍了在各权限模式下哪些结果会导致中止,以及如何使用 `allowed-tools` 预先批准命令
3591* ``Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found``:skill 的 frontmatter 要求 bash,但机器上没有 bash。请安装 Git for Windows,或将 frontmatter 改为 `shell: powershell`。请参阅[注入命令的运行方式](https://code.claude.com/docs/zh-CN/skills.md#how-injected-commands-run)3594* ``Skill <name> requires bash (`shell: bash` in frontmatter) but Git Bash was not found``:该 skill 的 frontmatter 要求使用 bash,但机器上没有 bash。请安装 Git for Windows,或将 frontmatter 改为 `shell: powershell`。请参阅[注入命令的运行方式](https://code.claude.com/docs/zh-CN/skills.md#how-injected-commands-run)
3592* `No shell command in <name> was run`:文件中某个 `!` 命令包含制表符或换行符以外的原始控制字符,因此所有命令都不会运行。请参阅[如何找到并删除该字符](#no-shell-command-was-run)
3593 3595
3594**解决方法:**3596**解决方法:**
3595 3597
3599 3601
3600### skill 或命令中的 shell 命令均未运行3602### skill 或命令中的 shell 命令均未运行
3601 3603
3602skill 或自定义命令文件中的某个 `` !`<command>` `` [动态上下文命令](https://code.claude.com/docs/zh-CN/skills.md#inject-dynamic-context)包含除制表符或换行符之外的原始控制字符。Claude Code 会在文件中的任何命令运行之前拒绝整个调用。3604`No shell command in <name> was run` 表示该 skill 或命令文件中的某个 `` !`<command>` `` [动态上下文命令](https://code.claude.com/docs/zh-CN/skills.md#inject-dynamic-context)包含 Bash 或 PowerShell 工具拒绝的字符:
3605
3606* **两种工具**:除制表符或换行符以外的原始控制字符
3607* **PowerShell 工具**:此外还有 U+FEFF 或 U+180E
3603 3608
3604消息会指出本应运行这些命令的 shell 工具(Bash 或 PowerShell),并以被拒绝的命令结尾。每个此类字符都会被替换为 `�`,以便您看到它的位置:3609消息末尾会附上被拒绝的命令,并将每个被拒绝的字符显示为 `�`,如以下 Bash 工具示例所示:
3605 3610
3606```text theme={null}3611```text theme={null}
3607No shell command in /my-skill was run, because the Bash tool does not accept one of them: command contains control characters that would be hidden in the approval dialog. Unprintable characters are shown as � below: remove them from the skill or command file, or from the arguments or options substituted into it.3612No shell command in /my-skill was run, because the Bash tool does not accept one of them: command contains control characters that would be hidden in the approval dialog. Unprintable characters are shown as � below: remove them from the skill or command file, or from the arguments or options substituted into it.
3610 3615
3611**解决方法:**3616**解决方法:**
3612 3617
3613* 在消息末尾引用的命令中找到每个 `�`。从 skill 或命令文件中,或从代入文件的参数或选项中,删除它所代表的字符。3618* 在消息末尾引用的命令中找到每个 `�`。从 [skill 或命令文件](https://code.claude.com/docs/zh-CN/skills.md#where-skills-live)中,或从替换到该文件中的参数或[选项](https://code.claude.com/docs/zh-CN/plugins/manifest-reference.md#user-configuration)中,移除它所代表的字符。
3614 3619
3615### 使用 `--print` 时必须提供输入3620### 使用 `--print` 时必须提供输入
3616 3621
3739 3744
3740* **您没有传入基础分支**:Claude Code 与仓库的默认分支进行了比较,并建议您显式传入基础分支,如上例所示3745* **您没有传入基础分支**:Claude Code 与仓库的默认分支进行了比较,并建议您显式传入基础分支,如上例所示
3741* **您传入的基础分支已存在于您的克隆中**:提示为 ``Make sure <branch> exists locally or on origin (try `git fetch origin <branch>`)``3746* **您传入的基础分支已存在于您的克隆中**:提示为 ``Make sure <branch> exists locally or on origin (try `git fetch origin <branch>`)``
3742* **您传入的基础分支不在您的克隆中**:Claude Code 在比较之前从 origin 获取了该分支。提示为 ``<branch> was fetched from origin but shares no history with HEAD. If another branch is your real base, pass it explicitly (`/code-review ultra <branch>`)``;当 Claude Code 无法判断您的克隆是否为浅克隆时,会改为建议 `git fetch --unshallow origin`。在 v2.1.221 之前,对于每个获取的基础分支,提示都会建议 `git fetch --unshallow origin`,而在完整克隆上该命令会失败并显示 `fatal: --unshallow on a complete repository does not make sense`。3747* **您传入的基础分支不在克隆中**:Claude Code 在比较前已从 origin 获取了该分支。提示为 ``<branch> was fetched from origin but shares no history with HEAD. If another branch is your real base, pass it explicitly (`/code-review ultra <branch>`)``;当 Claude Code 无法判断您的克隆是否为浅克隆时,它会改为建议 `git fetch --unshallow origin`。在 v2.1.221 之前,对于每个获取的基础分支,提示都会建议 `git fetch --unshallow origin`,而在完整克隆上,该命令会失败并报错 `fatal: --unshallow on a complete repository does not make sense`。
3743 3748
3744**解决方法:**3749**解决方法:**
3745 3750
4568 4573
4569在 v2.1.281 之前,Read、Write、Edit 或 NotebookEdit 路径中的空字节会以指出 `Path contains null bytes` 的错误结束整个轮次,且工具根本不会运行。4574在 v2.1.281 之前,Read、Write、Edit 或 NotebookEdit 路径中的空字节会以指出 `Path contains null bytes` 的错误结束整个轮次,且工具根本不会运行。
4570 4575
4576### Command contains an invisible character
4577
4578[PowerShell 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#powershell-tool)拒绝运行包含 U+FEFF 或 U+180E 的命令:
4579
4580```text theme={null}
4581Error: command contains the invisible character U+FEFF (byte order mark) or U+180E (Mongolian vowel separator), and was not run. Remove the character, keep the text that needs it in a file that the command reads, or write it as $([char]0xFEFF) or $([char]0x180E) inside a double-quoted string
4582```
4583
4584**处理方法:**
4585
4586* **对于 Claude 编写的命令**:您无需修复任何内容。该消息会告诉 Claude 如何重写该命令。
4587* **对于 skill 或命令文件**:该消息跟在 `No shell command in <name> was run` 之后。请参阅[在何处找到该字符并将其移除](#no-shell-command-was-run)。
4588
4571### File is too large to read as an image4589### File is too large to read as an image
4572 4590
4573Claude 尝试使用 [Read 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#read-tool-behavior)将文件作为图像读取,但该文件大于 128 MB,这是 Read 从图像文件加载的上限。未读取任何内容,Claude 会收到以下错误作为工具结果:4591Claude 尝试使用 [Read 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#read-tool-behavior)将文件作为图像读取,但该文件大于 128 MB,这是 Read 从图像文件加载的上限。未读取任何内容,Claude 会收到以下错误作为工具结果:
5431* 将 PATH 条目设置为用户或系统环境变量,而不是在您的 PowerShell 配置文件中。扩展不运行您的配置文件,因此仅存在于那里的 PATH 编辑永远无法到达它。5449* 将 PATH 条目设置为用户或系统环境变量,而不是在您的 PowerShell 配置文件中。扩展不运行您的配置文件,因此仅存在于那里的 PATH 编辑永远无法到达它。
5432* 更改 PATH 后重启 VS Code。扩展检查 VS Code 在启动时捕获的 PATH,因此 PATH 更改仅在重启后生效。5450* 更改 PATH 后重启 VS Code。扩展检查 VS Code 在启动时捕获的 PATH,因此 PATH 更改仅在重启后生效。
5433 5451
5452### The Claude Code program for this computer could not be found
5453
5454[VS Code 扩展](https://code.claude.com/docs/zh-CN/vs-code.md)查找其内置捆绑的 Claude Code 副本,但没有找到为您的计算机构建的版本。该消息会指明您的计算机所需的构建版本:
5455
5456```text theme={null}
5457The Claude Code program for this computer, the Linux (linux-x64) build, could not be found.
5458```
5459
5460**应该怎么做:**
5461
5462* 如果消息说明了扩展包含的是哪个构建版本,则说明您安装的是适用于其他平台的扩展包:请安装为消息中指明的构建版本制作的扩展包
5463* 如果消息没有说明扩展包含的是哪个构建版本,请从编辑器的扩展视图中重新安装 Claude Code 扩展
5464* 或者,无论哪种情况,都可以将 [`claudeCode.claudeProcessWrapper`](https://code.claude.com/docs/zh-CN/vs-code#extension-settings) 设置为单独安装的 `claude` 二进制文件
5465
5466在 v2.1.290 之前,此错误显示为 `Unsupported platform: <platform>-<arch>. No compatible Claude Code binary found.`
5467
5434### Claude Code 的连接在此消息完成前结束5468### Claude Code 的连接在此消息完成前结束
5435 5469
5436[VS Code 扩展](https://code.claude.com/docs/zh-CN/vs-code.md)将您的消息发送到 `claude` 进程,连接在进程确认或完成之前无错误地结束。扩展无法判断消息是否已处理,因此它要求您再次发送:5470[VS Code 扩展](https://code.claude.com/docs/zh-CN/vs-code.md)将您的消息发送到 `claude` 进程,连接在进程确认或完成之前无错误地结束。扩展无法判断消息是否已处理,因此它要求您再次发送:
5549 5583
5550## 配置警告5584## 配置警告
5551 5585
5552要查找 Claude Code 在交互式会话启动时给出的警告,请先查看启动横幅下方,然后查看调试日志:5586要查找 Claude Code 在交互式会话启动时给出的警告,请先查看启动横幅下方,再查看调试日志:
5553 5587
5554* **启动横幅下方的行**:某些有关[权限规则](https://code.claude.com/docs/zh-CN/permissions.md)的警告,例如 [`⚠ Deny rule Bsh matches no tool · check for typos`](#matches-no-tool)5588* **启动横幅下方的行**:部分关于[权限规则](https://code.claude.com/docs/zh-CN/permissions.md)的警告,例如 [`⚠ Deny rule Bsh matches no tool · check for typos`](#matches-no-tool)
5555* **调试日志**:Claude Code 仅在调试模式下保留此日志。要读取其中的警告,请从 shell 使用 `claude --debug-file <path>` 启动 Claude Code,然后打开该路径下的文件。5589* **调试日志**:Claude Code 仅在调试模式下保留此日志。要读取其中的警告,请在 shell 中使用 `claude --debug-file <path>` 启动 Claude Code,然后打开该路径下的文件。
5556 5590
5557在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中([后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)之外),请在 stderr 上查找启动警告。5591在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,且不在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中时,请在 stderr 上查找启动警告。
5558 5592
5559在 v2.1.305 之前,在交互式会话中也请查看 stderr,包括现在显示为横幅下方行的权限规则警告。5593在 v2.1.305 之前,交互式会话中也需要在 stderr 上查找,包括现在显示为横幅下方行的权限规则警告。
5560 5594
5561### Claude Code 因无法恢复的界面错误而退出5595### Claude Code exited after an unrecoverable interface error
5562 5596
5563当 Claude Code 退出时,它会打印此消息,因为其终端界面在任一渲染器中遇到了无法恢复的错误。第二句仅在[全屏](https://code.claude.com/docs/zh-CN/fullscreen.md)渲染器启动时发生错误时出现:5597当 Claude Code 因其终端界面遇到无法恢复的错误而退出时(无论使用哪种渲染器),会打印此消息。仅当错误发生在[全屏](https://code.claude.com/docs/zh-CN/fullscreen.md)渲染器启动期间时,才会出现第二句:
5564 5598
5565```text theme={null}5599```text theme={null}
5566Claude Code exited after an unrecoverable interface error (<error>). It happened while the fullscreen renderer was starting, so the next launch will use the classic renderer (CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 forces that any time).5600Claude Code exited after an unrecoverable interface error (<error>). It happened while the fullscreen renderer was starting, so the next launch will use the classic renderer (CLAUDE_CODE_DISABLE_ALTERNATE_SCREEN=1 forces that any time).
5567```5601```
5568 5602
5569**要做什么:**5603**解决方法:**
5570 5604
5571* 再次启动 Claude Code。要继续该对话,请在同一目录中运行 `claude --resume`。5605* 重新启动 Claude Code。要继续之前的对话,请在同一目录中运行 `claude --resume`。
5572* 如果消息命名全屏渲染器,[全屏渲染](https://code.claude.com/docs/zh-CN/fullscreen.md#fullscreen-renderer-didnt-finish-starting)说明下一次启动的操作,这取决于您如何打开全屏,以及如何再次尝试全屏或保持经典渲染器。5606* 如果消息提到全屏渲染器,[全屏渲染](https://code.claude.com/docs/zh-CN/fullscreen.md#fullscreen-renderer-didnt-finish-starting)说明了下次启动时的行为(这取决于您启用全屏的方式),以及如何再次尝试全屏或保留经典渲染器。
5573 5607
5574在 v2.1.236 之前,Claude Code 在此类错误后退出而不打印消息。5608在 v2.1.236 之前,Claude Code 在发生此类错误后会直接退出而不打印消息。
5575 5609
5576### Agent 描述超过 15.0k token 限制5610### Agent descriptions are over the 15.0k-token limit
5577 5611
5578Claude Code 将此警告显示为对话视图中的启动通知,而不是在 stderr 上。您的[子代理](https://code.claude.com/docs/zh-CN/sub-agents.md)(内置子代理除外)的组合描述超过 Claude Code 估计的 15,000 个 token。每个 Agent 计算其名称加上其 `description` frontmatter。Claude Code 加载每个 Agent,无论总数是否超过限制,因此警告不会改变加载的内容。5612Claude Code 将此警告作为启动通知显示在对话视图中,而不是输出到 stderr。按 Claude Code 的估算,除内置子代理外,您的[子代理](https://code.claude.com/docs/zh-CN/sub-agents.md)描述总量超过 15,000 个 token。每个 Agent 计入其名称及其 `description` frontmatter。无论总量是否超过限制,Claude Code 都会加载所有 Agent,因此该警告不会改变加载的内容。
5579 5613
5580```text theme={null}5614```text theme={null}
5581Agent descriptions are over the 15.0k-token limit (~16.2k tokens) · ask Claude to trim agent descriptions in .claude/agents/5615Agent descriptions are over the 15.0k-token limit (~16.2k tokens) · ask Claude to trim agent descriptions in .claude/agents/
5582```5616```
5583 5617
5584**要做什么:**5618**解决方法:**
5585 5619
5586* 缩短您的 Agent 文件的 `description` frontmatter,或要求 Claude 为您修剪它们。5620* 缩短 Agent 文件中的 `description` frontmatter,或让 Claude 帮您精简。
5587* 删除您不再使用的 Agent 文件。5621* 删除不再使用的 Agent 文件。
5588 5622
5589### Hook needs quotes around a path with a space5623### Hook needs quotes around a path with a space
5590 5624
5591对话视图中的此通知表示某个 hook 的脚本未运行,因为其路径包含空格且未加引号。该 hook 是 shell 形式的 [`asyncRewake`](https://code.claude.com/docs/zh-CN/hooks#run-hooks-in-the-background) hook。在其 `command` 中,诸如 `python3` 的解释器后跟一个未加引号的路径占位符,而解析后的路径包含空格。5625对话视图中的此通知表示某个 hook 的脚本未运行,因为其路径包含空格且未加引号。该 hook 是 shell 形式的 [`asyncRewake`](https://code.claude.com/docs/zh-CN/hooks#run-hooks-in-the-background) hook。在其 `command` 中,`python3` 等解释器后面跟着一个未加引号的路径占位符,而解析后的路径包含空格。
5592 5626
5593通知以该 hook 的事件名称开头,并命名该脚本:5627通知以 hook 的事件名称开头,并指出脚本名称:
5594 5628
5595```text theme={null}5629```text theme={null}
5596Stop hook needs quotes around a path with a space (check.py)5630Stop hook needs quotes around a path with a space (check.py)
5597```5631```
5598 5632
5599**要做什么:**5633**解决方法:**
5600 5634
5601* 在运行通知所命名脚本的 hook 的 `command` 中,用双引号将路径括起来。在 JSON 文件中,将其写为 `"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/check.py\""`。5635* 在运行通知所指脚本的 hook 的 `command` 中,用双引号包裹路径。在 JSON 文件中,写作 `"command": "python3 \"${CLAUDE_PLUGIN_ROOT}/hooks/check.py\""`。
5602 5636
5603### Instruction file not loaded5637### Instruction file not loaded
5604 5638
5605交互式会话的对话视图中的此通知表示某个已存在的[记忆文件](https://code.claude.com/docs/zh-CN/memory.md#how-claude-md-files-load)未被加载。某项读取限制正在生效。5639交互式会话对话视图中的此通知表示某个存在的[记忆文件](https://code.claude.com/docs/zh-CN/memory.md#how-claude-md-files-load)未被加载,原因是存在读取限制。
5606 5640
5607```text theme={null}5641```text theme={null}
5608Instruction file not loaded (a Read deny rule covers it):5642Instruction file not loaded (a Read deny rule covers it):
5609path: .claude/rules/shared.md5643path: .claude/rules/shared.md
5610```5644```
5611 5645
5612括号内容说明原因,例如:5646括号中说明原因,例如:
5613 5647
5614* **`a Read deny rule covers it`**:某条 `Read` [拒绝规则](https://code.claude.com/docs/zh-CN/permissions.md#read-and-edit)与该文件按原样书写的路径或其链接指向的位置匹配5648* **`a Read deny rule covers it`**:某条 `Read` [拒绝规则](https://code.claude.com/docs/zh-CN/permissions.md#read-and-edit)匹配该文件的书面路径或其上链接所指向的位置
5615* **`it's read from outside your working directories, where reads are blocked`**:在 [`permissions.blockReadsOutsideWorkingDirectories`](https://code.claude.com/docs/zh-CN/settings-reference#permissions-blockreadsoutsideworkingdirectories) 开启时,该文件解析到[工作目录](https://code.claude.com/docs/zh-CN/settings-reference.md#permissions-blockreadsoutsideworkingdirectories)之外5649* **`it's read from outside your working directories, where reads are blocked`**:在启用 [`permissions.blockReadsOutsideWorkingDirectories`](https://code.claude.com/docs/zh-CN/settings-reference#permissions-blockreadsoutsideworkingdirectories) 时,该文件解析到了[工作目录](https://code.claude.com/docs/zh-CN/settings-reference.md#permissions-blockreadsoutsideworkingdirectories)之外
5616* **`where it leads couldn't be worked out`**:例如,该文件是一个直接或通过其他链接指回自身的链接5650* **`where it leads couldn't be worked out`**:例如,该文件是一个直接或通过其他链接指回自身的链接
5617 5651
5618当 Claude 处理某个子目录中的文件时,若该子目录自身的记忆文件无法加载,相同的行会在该轮次中出现在对话里。当被扣留的文件多于这些行所列出的文件时,最后一行会对其余文件计数,例如 `and 3 more instruction files not loaded`。5652当 Claude 在某个子目录中处理文件、而该子目录自身的记忆文件无法加载时,相同的行会在该轮次中出现在对话里。当被拦截的文件多于列出的行时,最后一行会统计其余数量,例如 `and 3 more instruction files not loaded`。
5619 5653
5620**要做什么:**5654**解决方法:**
5621 5655
5622* 如果该限制是有意为之,则无需操作:会话在没有该文件指令的情况下运行。5656* 如果该限制是有意为之,则无需处理:会话在没有该文件指令的情况下运行。
5623* 要加载因 `a Read deny rule covers it` 而被扣留的文件,请[删除或缩小该规则](https://code.claude.com/docs/zh-CN/permissions.md#manage-permissions)。然后启动新会话。5657* 要加载因 `a Read deny rule covers it` 而被拦截的文件,请[删除或收窄该规则](https://code.claude.com/docs/zh-CN/permissions.md#manage-permissions),然后启动新会话。
5624* 要加载因 `it's read from outside your working directories, where reads are blocked` 而被扣留的文件,请将该文件或其链接目标移到工作目录内。然后启动新会话。5658* 要加载因 `it's read from outside your working directories, where reads are blocked` 而被拦截的文件,请将该文件或其链接目标移到工作目录内,然后启动新会话。
5625* 要加载因 `where it leads couldn't be worked out` 而被扣留的文件,请检查该文件是否是指回自身的链接。如果是,请将链接指向一个存在的文件,或用常规文件替换它。然后启动新会话。5659* 要加载因 `where it leads couldn't be worked out` 而被拦截的文件,请检查该文件是否是指回自身的链接。如果是,请将链接指向一个存在的文件,或用普通文件替换它,然后启动新会话。
5626 5660
5627在 v2.1.292 之前,该通知在同一行中原因之后的末尾命名文件。5661在 v2.1.292 之前,通知会在同一行的原因之后列出文件名。
5628 5662
5629### skill、命令或工作流未被加载,因为其名称是保留的5663### A skill, command, or workflow wasn't loaded because its name is reserved
5630 5664
5631skill 文件夹、frontmatter `name`、`.claude/commands/` 中的文件或子文件夹,或[保存的工作流](https://code.claude.com/docs/zh-CN/workflows.md#save-the-workflow-for-reuse)使用名称 `anthropic-skills` 或以 `anthropic-skills:` 开头的名称。Claude Code [为从 claude.ai 同步的 skill 保留该名称](https://code.claude.com/docs/zh-CN/skills.md#names-reserved-for-synced-skills),不加载该项。5665某个 skill 文件夹、frontmatter 中的 `name`、`.claude/commands/` 中的文件或子文件夹,或某个[已保存的工作流](https://code.claude.com/docs/zh-CN/workflows.md#save-the-workflow-for-reuse)使用了名称 `anthropic-skills` 或以 `anthropic-skills:` 开头的名称。Claude Code [将该名称保留给从 claude.ai 同步的 skill](https://code.claude.com/docs/zh-CN/skills.md#names-reserved-for-synced-skills),因此不会加载该项。
5632 5666
5633Claude Code 将此警告显示为对话视图中的启动通知,而不是在 stderr 上:5667Claude Code 将此警告作为启动通知显示在对话视图中,而不是输出到 stderr:
5634 5668
5635```text theme={null}5669```text theme={null}
5636Not loaded: rename .claude/skills/anthropic-skills, then restart — its name uses "anthropic-skills", a name reserved for the skills synced from your claude.ai account5670Not loaded: rename .claude/skills/anthropic-skills, then restart — its name uses "anthropic-skills", a name reserved for the skills synced from your claude.ai account
5637```5671```
5638 5672
5639通知命名它拒绝的第一项需要更改的内容:要重命名的文件夹或文件、要编辑的 `name:` 行,或要重命名的工作流。当拒绝多个项时,通知以计数结尾,例如 `· 2 more`,[调试日志](https://code.claude.com/docs/zh-CN/debug-your-config.md)命名每一个。5673通知会针对被拒绝的第一项说明需要更改的内容:要重命名的文件夹或文件、要编辑的 `name:` 行,或要重命名的工作流。当被拒绝的项不止一个时,通知末尾会带有计数,例如 `· 2 more`,[调试日志](https://code.claude.com/docs/zh-CN/debug-your-config.md)会列出每一项。
5640 5674
5641**要做什么:**5675**解决方法:**
5642 5676
5643* 重命名通知命名的项,或编辑它指向的 `name:` 行,然后重启会话。5677* 重命名通知所指的项,或编辑其指向的 `name:` 行,然后重启会话。
5644 5678
5645在 v2.1.282 之前,Claude Code 加载具有这些名称的 skill 和命令。5679在 v2.1.282 之前,Claude Code 会加载使用这些名称的 skill 和命令。
5646 5680
5647### Skill or command name refused5681### Skill or command name refused
5648 5682
5649此启动通知表示 Claude Code 拒绝了至少一个 [skill 或自定义命令](https://code.claude.com/docs/zh-CN/skills.md)的名称,因此它未被加载,或在没有其 `name` 字段的情况下加载:5683此启动通知表示 Claude Code 拒绝了至少一个 [skill 或自定义命令](https://code.claude.com/docs/zh-CN/skills.md)的名称,因此它未被加载,或在不带 `name` 字段的情况下加载:
5650 5684
5651```text theme={null}5685```text theme={null}
56521 skill or command name refused: run with --debug to see which ([names]), rename, then restart — a name may not hold hidden, direction-changing or blank-like characters, < or >, or be over 256 characters56861 skill or command name refused: run with --debug to see which ([names]), rename, then restart — a name may not hold hidden, direction-changing or blank-like characters, < or >, or be over 256 characters
5653```5687```
5654 5688
5655* **未加载**:Claude Code 拒绝了 skill 或命令所使用的名称,例如其目录名称,或命令文件的名称或子文件夹。它不会出现在 `/` 菜单中,Claude 也无法调用它。它在调试日志中的行显示为 `<name> is not offered`。5689* **未加载**:Claude Code 拒绝了 skill 或命令所使用的名称,例如其目录名、命令文件名或子文件夹。它不会出现在 `/` 菜单中,Claude 也无法调用它。它在调试日志中的行为 `<name> is not offered`。
5656* **`name` 字段被忽略**:Claude Code 拒绝了 skill 的 frontmatter `name`。该 skill 仍会加载,但 `/` 菜单不显示该 `name` 值,输入它也不会调用该 skill。它在调试日志中的行显示为 `<name value> is not shown for <skill>`。5690* **忽略 `name` 字段**:Claude Code 拒绝了 skill 的 frontmatter `name`。该 skill 仍会加载,但 `/` 菜单不显示该 `name` 值,输入它也不会调用该 skill。它在调试日志中的行为 `<name value> is not shown for <skill>`。
5657 5691
5658**要做什么:**5692**解决方法:**
5659 5693
5660* 从 shell 使用 `claude --debug` 启动 Claude Code,并在[调试日志](https://code.claude.com/docs/zh-CN/debug-your-config.md)中搜索 `[names]`。通知计数的每个名称在其中都有一行。该行会将某些隐藏字符写成代码,例如用 `\u{200B}` 表示零宽空格,以便您看到它们的位置。5694* 在 shell 中使用 `claude --debug` 启动 Claude Code,并在[调试日志](https://code.claude.com/docs/zh-CN/debug-your-config.md)中搜索 `[names]`。通知统计的每个名称在其中各有一行。该行会将部分隐藏字符写成代码,例如用 `\u{200B}` 表示零宽空格,以便您看出它们的位置。
5661* 通过重命名文件夹或文件或编辑 `name:` 行来删除 [skill 名称不能包含的字符](https://code.claude.com/docs/zh-CN/skills.md#characters-a-skill-name-cant-hold),或缩短超过 256 个字符的名称。然后重启会话,除非该文件位于 Claude Code [监视更改](https://code.claude.com/docs/zh-CN/skills.md#live-change-detection)的目录中。对于来自非您编写的插件的 skill,请要求插件作者重命名它。5695* 通过重命名文件夹或文件、或编辑 `name:` 行来删除 [skill 名称不能包含的字符](https://code.claude.com/docs/zh-CN/skills.md#characters-a-skill-name-cant-hold),或缩短超过 256 个字符的名称。然后重启会话,除非该文件位于 Claude Code [监视更改](https://code.claude.com/docs/zh-CN/skills.md#live-change-detection)的目录中。对于来自非您编写的插件的 skill,请让插件作者重命名。
5662 5696
5663### 工作区尚未被信任5697### Workspace has not been trusted
5664 5698
5665Claude Code 在项目的 `.claude/settings.json` 或 `.claude/settings.local.json` 中找到了 `permissions.allow` 规则或 `permissions.additionalDirectories` 条目,但未应用它们,因为[来自项目设置的允许规则需要工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)。计数、设置名称和消息中命名的文件因您的配置而异。`deny` 和 `ask` 规则不受影响。5699Claude Code 在项目的 `.claude/settings.json` 或 `.claude/settings.local.json` 中发现了 `permissions.allow` 规则或 `permissions.additionalDirectories` 条目,但没有应用它们,因为[来自项目设置的允许规则需要工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)。消息中的数量、设置名称和文件会因您的配置而异。`deny` 和 `ask` 规则不受影响。
5666 5700
5667```text theme={null}5701```text theme={null}
5668Ignoring 2 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/you/project"].hasTrustDialogAccepted: true in /Users/you/.claude.json.5702Ignoring 2 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/you/project"].hasTrustDialogAccepted: true in /Users/you/.claude.json.
5669```5703```
5670 5704
5671**要做什么:**5705**解决方法:**
5672 5706
5673* 在目录中运行 `claude` 并接受信任对话框。[项目允许规则和工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)说明该接受涵盖的文件夹。5707* 在该目录中运行 `claude` 并接受信任对话框。[项目允许规则与工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)说明了该接受操作覆盖哪个文件夹。
5674* 在[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中使用 `-p` 不显示对话框。使用消息打印的确切 `projects` 键在 `~/.claude.json` 中设置 `hasTrustDialogAccepted` 条目。5708* 在使用 `-p` 的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下不会显示对话框。请使用消息中打印的确切 `projects` 键,在 `~/.claude.json` 中设置 `hasTrustDialogAccepted` 条目。
5675* 如果消息命名 `.claude/settings.local.json` 并且您在 git 仓库外或主目录中启动了 Claude Code,请更新到 v2.1.200 或更高版本。版本 2.1.196 至 2.1.199 在这些工作区中将您自己的 `.claude/settings.local.json` 视为仓库提供的。在 v2.1.207 及更高版本上,如果您尚未信任该文件夹,在 git 仓库外仅更新是不够的:确定文件夹不在仓库内会运行 git,Claude Code 仅在您接受信任对话框后才运行该检查,因此请使用第一步。您的主目录和任何其他[配置主目录](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)是豁免的,不等待对话框。请参阅[项目允许规则和工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)。5709* 如果消息指出的是 `.claude/settings.local.json`,并且您是在 git 仓库之外或主目录中启动 Claude Code 的,请更新到 v2.1.200 或更高版本。版本 2.1.196 至 2.1.199 在这些工作区中会将您自己的 `.claude/settings.local.json` 视为由仓库提供。在 v2.1.207 及更高版本中,如果您尚未信任该文件夹,在 git 仓库之外仅更新是不够的:判断文件夹是否不在仓库内需要运行 git,而 Claude Code 只会在您接受信任对话框后才运行该检查,因此请使用第一步。您的主目录以及任何其他[配置主目录](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)不受此限制,无需等待对话框。请参阅[项目允许规则与工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)。
5676 5710
5677### 工作目录是网络路径5711### Working directory is a network path
5678 5712
5679Claude Code 不将网络路径添加为工作目录。查找网络路径可能会联系它命名的主机,在 Windows 上该联系可能会向主机发送您的凭据。因此 Claude Code 拒绝该路径而不查找它。5713Claude Code 不会将网络路径添加为工作目录。查找网络路径可能会联系其指定的主机,而在 Windows 上,这种联系可能会向该主机发送您的凭据。因此,Claude Code 会在不查找的情况下拒绝该路径。
5680 5714
5681当您使用网络路径运行 `/add-dir` 时,您会看到此消息:5715当您使用网络路径运行 `/add-dir` 时会看到此消息:
5682 5716
5683```text theme={null}5717```text theme={null}
5684\\server\share is a network path, which cannot be added as a working directory. On Windows, map the share to a drive letter and pass it at launch with --add-dir (a drive letter added mid-session does not yet carry remote-read trust).5718\\server\share is a network path, which cannot be added as a working directory. On Windows, map the share to a drive letter and pass it at launch with --add-dir (a drive letter added mid-session does not yet carry remote-read trust).
5685```5719```
5686 5720
5687当您改为在启动时通过 `--add-dir` 或 `permissions.additionalDirectories` 传递网络路径时,Claude Code 启动时不包含该目录。在交互式会话中,您在启动时看不到该消息,因为它与其他[启动警告](#configuration-warnings)一起写入调试日志。5721如果改为在启动时通过 `--add-dir` 或 `permissions.additionalDirectories` 传入网络路径,Claude Code 会在不包含该目录的情况下启动。在交互式会话中,您不会在启动时看到此消息,因为它会与其他[启动警告](#configuration-warnings)一起写入调试日志。
5688 5722
5689Claude Code 以这种方式拒绝的路径包括:5723Claude Code 以这种方式拒绝的路径包括:
5690 5724
5691* UNC 共享,例如 `\\server\share`5725* UNC 共享,例如 `\\server\share`
5692* 自动挂载路径,例如 `/net/<host>`,除非您从该主机的自动挂载下的目录启动了 Claude Code。对该自动挂载下的读取仍会经过[网络路径检查](https://code.claude.com/docs/zh-CN/permissions.md#network-paths)。5726* 自动挂载路径,例如 `/net/<host>`,除非您是从该主机自动挂载下的目录启动 Claude Code 的。该自动挂载下的读取仍会经过[网络路径检查](https://code.claude.com/docs/zh-CN/permissions.md#network-paths)。
5693* 通过符号链接或连接点到达网络位置的本地路径5727* 通过符号链接或联接点到达网络位置的本地路径
5694 5728
5695映射的驱动器号和 `\\wsl$` 路径不计为网络路径。5729映射的驱动器号和 `\\wsl$` 路径不算作网络路径。
5696 5730
5697**要做什么:**5731**解决方法:**
5698 5732
5699* 在 Windows 上,将共享映射到驱动器号,并在启动时传递该驱动器。例如,在 PowerShell 中运行 `net use Z: \\server\share`,然后运行 `claude --add-dir Z:\`。5733* 在 Windows 上,将共享映射到驱动器号,并在启动时传入该驱动器。例如,在 PowerShell 中运行 `net use Z: \\server\share`,然后运行 `claude --add-dir Z:\`。
5700* 在 macOS 或 Linux 上,将共享挂载到本地路径并改为添加该路径。5734* 在 macOS 或 Linux 上,将共享挂载到本地路径,然后改为添加该路径。
5701* 如果路径在 `permissions.additionalDirectories` 中,请从列出它的设置文件中删除它。5735* 如果该路径位于 `permissions.additionalDirectories` 中,请从列出它的设置文件中删除它。
5702 5736
5703在 v2.1.257 之前,Claude Code 接受可达的网络路径作为工作目录。5737在 v2.1.257 之前,Claude Code 会接受可访问的网络路径作为工作目录。
5704 5738
5705### 远程托管设置加载失败5739### Remote managed settings failed to load
5706 5740
5707您的会话符合[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)的条件,但 Claude Code 无法获取它们或无法应用服务器返回的内容,因此在交互式会话中显示此警告。5741您的会话符合使用[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)的条件,但 Claude Code 无法获取这些设置,或无法应用服务器返回的内容,因此会在交互式会话中显示此警告。
5708 5742
5709括号中的原因命名失败的内容,例如 `network error`、`request timed out` 或 `authentication rejected (401)`。原因 `no setting in the server response could be applied as written` 意味着服务器已应答,但它返回的设置都没有通过[验证](https://code.claude.com/docs/zh-CN/server-managed-settings.md#invalid-entries-in-delivered-settings)。在 v2.1.282 之前,此原因显示为 `server returned invalid settings`。5743括号中的原因说明了失败的内容,例如 `network error`、`request timed out` 或 `authentication rejected (401)`。原因 `no setting in the server response could be applied as written` 表示服务器已响应,但其返回的设置均未通过[验证](https://code.claude.com/docs/zh-CN/server-managed-settings.md#invalid-entries-in-delivered-settings)。在 v2.1.282 之前,此原因显示为 `server returned invalid settings`。
5710 5744
5711该行的其余部分说明会话运行的策略:5745该行的其余部分说明会话使用的策略:
5712 5746
5713* **从较早的成功获取缓存的设置**:Claude Code 在该缓存策略上运行会话,但[扣留的环境变量](https://code.claude.com/docs/zh-CN/server-managed-settings.md#fetch-and-caching-behavior)除外,该行显示 `using cached policy`。5747* **存在此前成功获取时缓存的设置**:Claude Code 使用该缓存策略运行会话([被保留的环境变量](https://code.claude.com/docs/zh-CN/server-managed-settings.md#fetch-and-caching-behavior)除外),该行显示 `using cached policy`。
5714* **无缓存**:Claude Code 在没有服务器托管设置的情况下运行会话,该行显示 `no remote policy applied`。5748* **无缓存**:Claude Code 在没有服务器托管设置的情况下运行会话,该行显示 `no remote policy applied`。
5715 5749
5716**要做什么:**5750**解决方法:**
5717 5751
5718* 对消息命名的原因采取行动:对于网络原因,检查此计算机是否可以到达 `api.anthropic.com`;对于身份验证原因,使用 `/status` 检查您的登录5752* 根据消息指出的原因处理:对于网络原因,请检查此计算机能否访问 `api.anthropic.com`;对于身份验证原因,请使用 `/status` 检查您的登录状态
5719* 对于 `no setting in the server response could be applied as written`,要求您的管理员更正服务器上的设置5753* 对于 `no setting in the server response could be applied as written`,请让管理员修正服务器上的设置
5720* 运行 `/status` 或 `claude doctor` 以获取完整诊断5754* 运行 `/status` 或 `claude doctor` 获取完整诊断
5721 5755
5722在 v2.1.248 之前,Claude Code 仅在调试日志中报告失败的设置获取。5756在 v2.1.248 之前,Claude Code 仅在调试日志中报告设置获取失败。
5723 5757
5724### 托管设置未被批准5758### Managed settings were not approved
5725 5759
5726您的组织的[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)包括需要您批准的设置,您拒绝了[安全批准对话框](https://code.claude.com/docs/zh-CN/server-managed-settings.md#security-approval-dialogs),因此 Claude Code 退出而不应用它们:5760您组织的[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)包含需要您批准的设置,而您拒绝了[安全批准对话框](https://code.claude.com/docs/zh-CN/server-managed-settings.md#security-approval-dialogs),因此 Claude Code 会在不应用这些设置的情况下退出:
5727 5761
5728```text theme={null}5762```text theme={null}
5729Managed settings were not approved; exiting without applying them.5763Managed settings were not approved; exiting without applying them.
5730```5764```
5731 5765
5732**要做什么:**5766**解决方法:**
5733 5767
5734* 再次启动 Claude Code 并批准对话框以在您的组织设置下继续。拒绝的对话框不会被记住,因此在下一次启动时会再次出现。5768* 再次启动 Claude Code 并批准该对话框,以便在组织设置下继续使用。被拒绝的对话框不会被记住,因此下次启动时会再次出现。
5735* 如果您对对话框列出的设置不确定,请在批准前询问维护您的组织托管设置的人5769* 如果您对对话框列出的某项设置不确定,请在批准前咨询负责维护组织托管设置的人员
5736 5770
5737### 托管设置需要您的批准5771### Managed settings need your approval
5738 5772
5739您的组织的[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)包括需要您在[安全批准对话框](https://code.claude.com/docs/zh-CN/server-managed-settings.md#security-approval-dialogs)中批准的设置。您运行的 `claude plugin` 命令无法从键盘读取,因此无法显示该对话框。当您通过管道传递或重定向其输入,并且在 macOS 和 Linux 上它也无法打开 `/dev/tty` 时,就会发生这种情况。该命令在进行任何更改之前已停止:5773您组织的[服务器托管设置](https://code.claude.com/docs/zh-CN/server-managed-settings.md)包含需要您在[安全批准对话框](https://code.claude.com/docs/zh-CN/server-managed-settings.md#security-approval-dialogs)中批准的设置。您运行的 `claude plugin` 命令无法从键盘读取输入,因此无法显示该对话框。当您通过管道或重定向传入其输入、且(在 macOS 和 Linux 上)它也无法打开 `/dev/tty` 时,就会发生这种情况。该命令在做出任何更改之前就已停止:
5740 5774
5741```text theme={null}5775```text theme={null}
5742Your organization's managed settings need your approval, which couldn't be asked for here. Run `claude` in a terminal and approve them, then run this command again.5776Your organization's managed settings need your approval, which couldn't be asked for here. Run `claude` in a terminal and approve them, then run this command again.
5743```5777```
5744 5778
5745**要做什么:**5779**解决方法:**
5746 5780
5747* 在终端中运行 `claude`,并在对话框出现时批准这些设置,然后再次运行相同的 `claude plugin` 命令。Claude Code 将批准和已批准的设置保存在您的[配置目录](https://code.claude.com/docs/zh-CN/server-managed-settings.md#approval-memory)中。如果已停止的命令以其他用户身份运行或设置了 `CLAUDE_CONFIG_DIR`,请以相同方式运行 `claude`,以便两者使用同一目录。5781* 在终端中运行 `claude`,在对话框出现时批准这些设置,然后再次运行同一 `claude plugin` 命令。Claude Code 会将批准记录和已批准的设置保存在您的[配置目录](https://code.claude.com/docs/zh-CN/server-managed-settings.md#approval-memory)中。如果停止的命令是以其他用户身份运行的,或设置了 `CLAUDE_CONFIG_DIR`,请以相同方式运行 `claude`,使两者使用同一目录。
5748 5782
5749### 托管设置阻止默认模型5783### Managed settings block the default model
5750 5784
5751您的组织的[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)阻止默认选项解析到的模型以及它可以降级到的每个模型。将在默认选项上启动的会话在启动时退出,而不是运行被阻止的模型。您看到的消息取决于阻止它的设置。当 [`deniedModels`](https://code.claude.com/docs/zh-CN/model-config#block-specific-models-or-versions) 列表阻止它时,消息显示为:5785您组织的[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)阻止了 Default 选项解析到的模型,以及它可以降级到的所有模型。本应使用 Default 选项启动的会话会在启动时退出,而不是运行被阻止的模型。您看到的消息取决于阻止它的设置。当 [`deniedModels`](https://code.claude.com/docs/zh-CN/model-config#block-specific-models-or-versions) 列表阻止它时,消息为:
5752 5786
5753```text theme={null}5787```text theme={null}
5754Claude Code can't start: your organization's managed settings block the default model (claude-opus-5-5) in "deniedModels", and none of the models they allow can be used as the default instead. Ask your administrator to update "deniedModels" or "availableModels".5788Claude Code can't start: your organization's managed settings block the default model (claude-opus-5-5) in "deniedModels", and none of the models they allow can be used as the default instead. Ask your administrator to update "deniedModels" or "availableModels".
5755```5789```
5756 5790
5757当 [`availableModelsMatch`](https://code.claude.com/docs/zh-CN/settings-reference#availablemodelsmatch) 设置为 `"exact"` 的 `availableModels` 列表省略它时,消息显示为:5791当 [`availableModelsMatch`](https://code.claude.com/docs/zh-CN/settings-reference#availablemodelsmatch) 设为 `"exact"` 的 `availableModels` 列表未包含它时,消息为:
5758 5792
5759```text theme={null}5793```text theme={null}
5760Claude Code can't start: your organization allows only the models listed in "availableModels", and none of them can be used as the default model (claude-opus-5-5 isn't listed). Ask your administrator to update "availableModels".5794Claude Code can't start: your organization allows only the models listed in "availableModels", and none of them can be used as the default model (claude-opus-5-5 isn't listed). Ask your administrator to update "availableModels".
5761```5795```
5762 5796
5763**要做什么:**5797**解决方法:**
5764 5798
5765* 如果您管理设置,请将您的用户可以运行的模型添加到 `availableModels`,或缩小阻止每个备用模型的 `deniedModels` 条目。[阻止特定模型或版本](https://code.claude.com/docs/zh-CN/model-config.md#block-specific-models-or-versions)描述默认选项如何降级5799* 如果您负责管理这些设置,请向 `availableModels` 添加用户可以运行的模型,或收窄阻止所有备用模型的 `deniedModels` 条目。[阻止特定模型或版本](https://code.claude.com/docs/zh-CN/model-config.md#block-specific-models-or-versions)介绍了 Default 选项的降级方式
5766* 如果您不管理它们,请将消息发送给您的管理员。您自己的设置文件无法扩大托管的 `availableModels` 或 `deniedModels` 列表5800* 如果您不负责管理这些设置,请将消息发送给管理员。您自己的设置文件无法扩大托管的 `availableModels` 或 `deniedModels` 列表
5767 5801
5768### 托管设置不允许此 API 提供商5802### Managed settings don't allow this API provider
5769 5803
5770您的组织的[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)设置了 [`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders) 列表,会话的 API 提供商不在其上,或会话使用的端点不是按该条目要求的方式固定的。Claude Code 在启动时、登录前或会话下次联系 API 时拒绝。消息以允许的提供商开头:5804您组织的[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)设置了 [`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders) 列表,而会话的 API 提供商不在该列表中,或者会话使用的端点未按该条目要求的方式固定。Claude Code 会在启动时、登录前或会话下次联系 API 时拒绝。消息以允许的提供商开头:
5771 5805
5772```text theme={null}5806```text theme={null}
5773Your organization's managed settings allow Claude Code to use: Anthropic API, Amazon Bedrock.5807Your organization's managed settings allow Claude Code to use: Anthropic API, Amazon Bedrock.
5774```5808```
5775 5809
5776当列表为空时,消息改为显示:5810当列表为空时,消息改为:
5777 5811
5778```text theme={null}5812```text theme={null}
5779Your organization's managed settings allow Claude Code to use no API provider at all (allowedProviders is an empty list), so it cannot start on this machine.5813Your organization's managed settings allow Claude Code to use no API provider at all (allowedProviders is an empty list), so it cannot start on this machine.
5780```5814```
5781 5815
5782当每个条目都无法识别时,括号内容改为 `(allowedProviders lists only unrecognized entries)`。5816当所有条目都无法识别时,括号内容改为 `(allowedProviders lists only unrecognized entries)`。
5783 5817
5784**要做什么:**5818**解决方法:**
5785 5819
5786* 按照消息的 `To continue:` 步骤进行5820* 按照消息中 `To continue:` 的步骤操作
5787* 如果您管理设置,消息中以 `Admins:` 开头的行命名要添加的条目或要固定的值,[`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders) 条目说明哪个源的 `env` 块可以固定它5821* 如果您负责管理这些设置,消息中以 `Admins:` 开头的行会指出要添加的条目或要固定的值,[`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders) 条目说明了哪些来源的 `env` 块可以固定它
5788 5822
5789### MCP 服务器被企业托管策略阻止5823### MCP server is blocked by enterprise managed policy
5790 5824
5791您在 `/mcp` 中的服务器上选择了**重新连接**,或在那里重新打开了禁用的服务器,而[限制 MCP 服务器](https://code.claude.com/docs/zh-CN/managed-mcp.md)的设置阻止了该服务器。Claude Code 拒绝连接它并显示:5825您在 `/mcp` 中对某个服务器选择了 **Reconnect**,或在其中重新启用了已禁用的服务器,而某项[限制 MCP 服务器](https://code.claude.com/docs/zh-CN/managed-mcp.md)的设置阻止了该服务器。Claude Code 拒绝连接它并显示:
5792 5826
5793```text theme={null}5827```text theme={null}
5794MCP server <name> is blocked by enterprise managed policy5828MCP server <name> is blocked by enterprise managed policy
5795```5829```
5796 5830
5797这些设置中的任何一个都可以产生该消息:5831以下任一设置都可能导致此消息:
5798 5832
5799* 与服务器匹配的 [`deniedMcpServers`](https://code.claude.com/docs/zh-CN/managed-mcp#policy-based-control-with-allowlists-and-denylists) 条目,包括您自己的 `~/.claude/settings.json` 或项目的 `.claude/settings.json` 中的条目5833* 与该服务器匹配的 [`deniedMcpServers`](https://code.claude.com/docs/zh-CN/managed-mcp#policy-based-control-with-allowlists-and-denylists) 条目,包括您自己的 `~/.claude/settings.json` 或项目的 `.claude/settings.json` 中的条目
5800* 服务器不匹配的 [`allowedMcpServers`](https://code.claude.com/docs/zh-CN/managed-mcp#policy-based-control-with-allowlists-and-denylists) 列表5834* 该服务器不匹配的 [`allowedMcpServers`](https://code.claude.com/docs/zh-CN/managed-mcp#policy-based-control-with-allowlists-and-denylists) 列表
5801* 锁定了 `mcp` 的 [`strictPluginOnlyCustomization`](https://code.claude.com/docs/zh-CN/settings-reference#strictpluginonlycustomization),这会阻止在 `~/.claude.json` 和 `.mcp.json` 中配置的服务器5835* 锁定了 `mcp` 的 [`strictPluginOnlyCustomization`](https://code.claude.com/docs/zh-CN/settings-reference#strictpluginonlycustomization),它会阻止在 `~/.claude.json` 和 `.mcp.json` 中配置的服务器
5802* [`disableClaudeAiConnectors`](https://code.claude.com/docs/zh-CN/mcp#disable-claude-ai-connectors),当服务器是 claude.ai 连接器时5836* 当服务器是 claude.ai 连接器时的 [`disableClaudeAiConnectors`](https://code.claude.com/docs/zh-CN/mcp#disable-claude-ai-connectors)
5803 5837
5804**要做什么:**5838**解决方法:**
5805 5839
5806* 检查您自己的用户和项目设置文件中是否有这些设置之一,并更改或删除它5840* 检查您自己的用户和项目设置文件中是否有上述设置之一,并更改或删除它
5807* 如果您自己的设置都不能解释该阻止,请询问您的管理员哪个托管设置阻止了服务器5841* 如果您自己的设置都无法解释该阻止,请询问管理员是哪项托管设置阻止了该服务器
5808 5842
5809在 v2.1.257 之前,`/mcp` 中的**重新连接**和重新启用可以连接被会话中途策略更新阻止的服务器。5843在 v2.1.257 之前,`/mcp` 中的 **Reconnect** 和重新启用操作可以连接被会话中途策略更新所阻止的服务器。
5810 5844
5811### MCP 服务器名称是保留的5845### MCP server name is reserved
5812 5846
5813此消息命名您的某个 MCP 服务器,其名称属于 Claude Code 保留的名称,例如其内置服务器的名称:5847此消息指出您的某个 MCP 服务器,其名称属于 Claude Code 保留的名称,例如其内置服务器的名称:
5814 5848
5815```text theme={null}5849```text theme={null}
5816"workspace" is a reserved MCP server name and was not loaded5850"workspace" is a reserved MCP server name and was not loaded
5817```5851```
5818 5852
5819**要做什么:**5853**解决方法:**
5820 5854
5821* 在定义该服务器的位置重命名它,例如从 `workspace` 改为 `my-workspace`5855* 在定义该服务器的位置重命名它,例如从 `workspace` 改为 `my-workspace`
5822* 有关其他需要避免的保留名称,请参阅 [MCP 配置警告](https://code.claude.com/docs/zh-CN/mcp.md#configuration-warnings)5856* 有关需要避免的其他保留名称,请参阅 [MCP 配置警告](https://code.claude.com/docs/zh-CN/mcp.md#configuration-warnings)
5823 5857
5824### 托管设置文档无法解析5858### Managed settings document could not be parsed
5825 5859
5826您的组织部署了[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),其中一个部署的文档存在但无法解析为 JSON 对象,因此 Claude Code 在启动时以退出码 1 退出,而不是在没有该文档所携带策略的情况下运行。该行在消息前命名失败的源:5860您的组织部署了[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),其中某个已部署的文档存在但无法解析为 JSON 对象,因此 Claude Code 在启动时以退出码 1 退出,而不是在缺少该文档所含策略的情况下运行。该行会在消息之前指出失败的来源:
5827 5861
5828```text theme={null}5862```text theme={null}
5829/Library/Application Support/ClaudeCode/managed-settings.json: Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.5863/Library/Application Support/ClaudeCode/managed-settings.json: Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.
5830```5864```
5831 5865
5832源是以下之一:5866来源为以下之一:
5833 5867
5834* `managed-settings.json` 文件的路径或 `managed-settings.d` 下的放入文件5868* `managed-settings.json` 文件或 `managed-settings.d` 下的附加文件的路径
5835* macOS 托管首选项配置文件,`per-user managed preferences` 或 `device-level managed preferences`5869* macOS 托管偏好设置描述文件,`per-user managed preferences` 或 `device-level managed preferences`
5836* Windows 注册表值,`Registry: HKLM\SOFTWARE\Policies\ClaudeCode\Settings`5870* Windows 注册表值,`Registry: HKLM\SOFTWARE\Policies\ClaudeCode\Settings`
5837 5871
5838[查找 Claude Code 删除的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)列出了使每个源无法解析的原因。5872[查找 Claude Code 丢弃的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)列出了导致各来源无法解析的情况。
5839 5873
5840即使另一个管理员源提供了有效策略,Claude Code 也会拒绝启动。您在交互式会话、`claude -p`、Agent SDK 会话、[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)和大多数子命令(包括 `claude doctor`)中都会看到此错误。该拒绝有意采用失败关闭:Claude Code 无法解析的文档中的设置无法被强制执行,强行启动会在没有组织控制的情况下运行会话。5874即使另一个管理员来源提供了有效策略,Claude Code 也会拒绝启动。您会在交互式会话、`claude -p`、Agent SDK 会话、[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)以及大多数子命令(包括 `claude doctor`)中看到此错误。这种拒绝是有意采用的失败即关闭策略:Claude Code 无法解析的文档中的设置无法被强制执行,而强行启动会使会话在没有组织管控的情况下运行。
5841 5875
5842可解析文档中的 schema 问题不会产生此错误。[查找 Claude Code 删除的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)涵盖 Claude Code 对此类问题的处理方式。5876可解析文档中的 schema 问题不会产生此错误。[查找 Claude Code 丢弃的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)介绍了 Claude Code 如何处理这类问题。
5843 5877
5844当 `managed-settings.d/` 目录存在但无法列出时,Claude Code 改为报告 `Managed settings drop-in directory could not be read:`,后跟底层错误。[查找 Claude Code 删除的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)涵盖读取失败何时会在启动时退出。5878当 `managed-settings.d/` 目录存在但无法列出时,Claude Code 会改为报告 `Managed settings drop-in directory could not be read:`,后跟底层错误。[查找 Claude Code 丢弃的条目](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)介绍了读取失败何时会导致启动时退出。
5845 5879
5846**要做什么:**5880**解决方法:**
5847 5881
5848* 如果您管理计算机,请修复命名的文档使其解析为 JSON 对象,或删除文件、配置文件或注册表值。空的 `managed-settings.json` 计为 `{}`,不会阻止启动。5882* 如果您负责管理该计算机,请修复所指出的文档使其能解析为 JSON 对象,或删除该文件、描述文件或注册表值。空的 `managed-settings.json` 会被视为 `{}`,不会阻止启动。
5849* 如果您不管理,请要求您的管理员修复部署的文档。您自己的设置文件中的任何内容都不会导致或清除此错误。5883* 如果您不负责管理,请让管理员修复已部署的文档。您自己的设置文件不会导致或消除此错误。
5850 5884
5851### 无法读取托管策略设置5885### Unable to read managed policy settings
5852 5886
5853您的组织部署了[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),其中一个部署的源存在但无法读取,原因例如 I/O 错误,而不是操作系统拒绝读取。在没有其他管理员源提供策略的情况下,Claude Code 在启动时退出,而不是在没有该源可能携带的策略的情况下运行:5887您的组织部署了[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),其中某个已部署的来源存在但无法读取,原因是 I/O 错误等,而不是操作系统拒绝读取。在没有其他管理员来源提供策略的情况下,Claude Code 会在启动时退出,而不是在缺少该来源可能包含的策略的情况下运行:
5854 5888
5855```text theme={null}5889```text theme={null}
5856Unable to read managed policy settings.5890Unable to read managed policy settings.
5860Detail: <source>: <reason>5894Detail: <source>: <reason>
5861```5895```
5862 5896
5863在相同的状态下,登录流程、来自已运行会话的 API 请求和 [`claude gateway`](https://code.claude.com/docs/zh-CN/claude-apps-gateway) 服务器会被拒绝,并显示第一行的一个变体,其中命名 [`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders)。5897在同样的状态下,登录流程、已在运行的会话发出的 API 请求以及 [`claude gateway`](https://code.claude.com/docs/zh-CN/claude-apps-gateway) 服务器都会被拒绝,并显示第一行的一个变体,其中会提到 [`allowedProviders`](https://code.claude.com/docs/zh-CN/settings-reference#allowedproviders)。
5864 5898
5865操作系统拒绝的读取(例如对仅限 root 的文件)不会导致此退出:[会话启动时不使用该源的策略](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)。对于无法解析的源,Claude Code 以[命名该源的不同消息](#managed-settings-document-could-not-be-parsed)退出。5899被操作系统拒绝的读取(例如读取仅 root 可访问的文件)不会导致此退出:[会话会在不含该来源策略的情况下启动](https://code.claude.com/docs/zh-CN/managed-settings.md#find-entries-claude-code-dropped)。对于无法解析的来源,Claude Code 会以[另一条指出该来源的消息](#managed-settings-document-could-not-be-parsed)退出。
5866 5900
5867**要做什么:**5901**解决方法:**
5868 5902
5869* 如果您管理计算机,请修复 `Detail:` 行命名的问题,以便部署的源可以被读取,或删除该源5903* 如果您负责管理该计算机,请修复 `Detail:` 行指出的问题,使已部署的来源能够被读取,或删除该来源
5870* 如果您不管理,请将消息发送给您的管理员。您自己的设置文件中的任何内容都不会导致或清除此错误5904* 如果您不负责管理,请将消息发送给管理员。您自己的设置文件不会导致或消除此错误
5871 5905
5872在 v2.1.285 之前,仅使用 claude.ai 或 Claude Console 凭据登录的会话以此消息退出,并且操作系统拒绝的读取也会产生它。5906在 v2.1.285 之前,只有使用 claude.ai 或 Claude Console 凭据登录的会话才会以此消息退出,并且被操作系统拒绝的读取也会产生此消息。
5873 5907
5874### Managed settings contain invalid entries, including PreToolUse/PermissionRequest hooks that are NOT loaded5908### Managed settings contain invalid entries, including PreToolUse/PermissionRequest hooks that are NOT loaded
5875 5909
5876`-p` 运行中的此 stderr 块表示某个[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)源包含 Claude Code 无法加载的 hook 条目。该 hook 不会运行;当某行将该源的 `hooks` 字段列为已忽略时,该源的所有 hook 都不会运行。5910`-p` 运行输出的这段 stderr 内容表示某个[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)来源包含 Claude Code 无法加载的 hook 条目。该 hook 不会运行;当某一行列出该来源的 `hooks` 字段被忽略时,该来源的所有 hook 都不会运行。
5877 5911
5878每行命名源、字段(如有)以及问题,例如未知的 hook `type` 或在 `hooks` 键之外声明的 hook:5912每一行会指出来源、字段(如有)以及问题,例如未知的 hook `type`,或在 `hooks` 键之外声明的 hook:
5879 5913
5880```text theme={null}5914```text theme={null}
5881Managed settings contain invalid entries, including PreToolUse/PermissionRequest hooks that are NOT loaded; fix or remove each entry:5915Managed settings contain invalid entries, including PreToolUse/PermissionRequest hooks that are NOT loaded; fix or remove each entry:
5882 <source> (<field>): <message>5916 <source> (<field>): <message>
5883```5917```
5884 5918
5885**要做什么:**5919**解决方法:**
5886 5920
5887* 如果您管理该源,请修复或删除该块列出的每个条目。[Hook 配置](https://code.claude.com/docs/zh-CN/hooks.md#configuration)展示了 Claude Code 在 `hooks` 下期望的结构。5921* 如果您负责管理该来源,请修复或删除列出的每个条目。[Hook 配置](https://code.claude.com/docs/zh-CN/hooks.md#configuration)展示了 Claude Code 在 `hooks` 下期望的结构。
5888* 如果某行的源是 `parent managed settings`,则表示启动 Claude Code 的应用程序将该条目作为[父设置](https://code.claude.com/docs/zh-CN/managed-settings.md#parent-settings-from-embedding-hosts)传入,因此请向该应用程序的开发者报告5922* 如果某一行的来源是 `parent managed settings`,说明启动 Claude Code 的应用程序将该条目作为[父级设置](https://code.claude.com/docs/zh-CN/managed-settings.md#parent-settings-from-embedding-hosts)传入,请将其报告给该应用程序的开发者
5889* 否则,请将该块发送给您的管理员5923* 否则,请将这段内容发送给管理员
5890 5924
5891在 v2.1.300 之前,`-p` 运行会将此情况列在 `Managed settings failed to load; policies from the failed source are NOT in effect:` 标题下。5925在 v2.1.300 之前,`-p` 运行会将此情况列在 `Managed settings failed to load; policies from the failed source are NOT in effect:` 标题下。
5892 5926
5893### otelHeadersHelper 失败5927### otelHeadersHelper failed
5894 5928
5895当 [`otelHeadersHelper`](https://code.claude.com/docs/zh-CN/settings-reference#otelheadershelper) 脚本失败或打印不符合[脚本要求](https://code.claude.com/docs/zh-CN/monitoring-usage.md#script-requirements)的输出时,Claude Code 将此警告显示为终端界面中的通知,每个交互式会话一次。5929当 [`otelHeadersHelper`](https://code.claude.com/docs/zh-CN/settings-reference#otelheadershelper) 脚本失败,或其输出不符合[脚本要求](https://code.claude.com/docs/zh-CN/monitoring-usage.md#script-requirements)时,Claude Code 会在终端界面中以通知形式显示此警告,每个交互式会话显示一次。
5896 5930
5897当脚本持续失败时,导出失败,您的遥测后端从会话中接收不到任何内容。5931只要脚本持续失败,导出就会失败,您的遥测后端将收不到该会话的任何数据。
5898 5932
5899`See /status:` 后的文本说明失败的内容,例如脚本的退出码后跟其错误输出:5933`See /status:` 之后的文本说明了失败内容,例如脚本的退出码及其错误输出:
5900 5934
5901```text theme={null}5935```text theme={null}
5902otelHeadersHelper failed; telemetry is not being exported. See /status: exited 1: token service unreachable5936otelHeadersHelper failed; telemetry is not being exported. See /status: exited 1: token service unreachable
5903```5937```
5904 5938
5905**要做什么:**5939**解决方法:**
5906 5940
5907* 运行 `/status` 以读取失败详情。5941* 运行 `/status` 查看失败详情。
5908* 修复脚本使其在 30 秒内以 0 退出,并在 stdout 上打印由字符串标头值组成的 JSON 对象。请参阅[脚本要求](https://code.claude.com/docs/zh-CN/monitoring-usage.md#script-requirements)。5942* 修复脚本,使其在 30 秒内以 0 退出,并在 stdout 上打印一个值为字符串的请求头 JSON 对象。请参阅[脚本要求](https://code.claude.com/docs/zh-CN/monitoring-usage.md#script-requirements)。
5909* 如果您的组织通过[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)部署脚本,请要求维护它们的人修复它。5943* 如果您的组织通过[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)部署该脚本,请让负责维护的人员修复它。
5910 5944
5911在[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中使用 `-p` 时,相同的失败改为在 stderr 上显示为 `otelHeadersHelper failed (OpenTelemetry export headers unavailable): <error>`。5945在使用 `-p` 的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,同样的失败会改为在 stderr 上显示为 `otelHeadersHelper failed (OpenTelemetry export headers unavailable): <error>`。
5912 5946
5913### headersHelper 未运行5947### headersHelper not run
5914 5948
5915Claude Code 仅使用 MCP 服务器的静态 `headers` 连接了它,并跳过了服务器的 [`headersHelper`](https://code.claude.com/docs/zh-CN/mcp#use-dynamic-headers-for-custom-authentication),因为该助手是 shell 命令,而该文件夹没有保存的信任。当您手动在 `~/.claude.json` 中设置其条目时,或在主目录外,当您在交互式会话中为其接受信任对话框时,文件夹获得保存的信任。请参阅[在 headersHelper 运行前信任文件夹](https://code.claude.com/docs/zh-CN/mcp.md#trust-a-folder-before-its-headershelper-runs)了解此检查适用于哪些服务器。5949Claude Code 仅使用静态 `headers` 连接了某个 MCP 服务器,并跳过了该服务器的 [`headersHelper`](https://code.claude.com/docs/zh-CN/mcp#use-dynamic-headers-for-custom-authentication),因为该 helper 是一条 shell 命令,而该文件夹没有已保存的信任。当您手动在 `~/.claude.json` 中设置文件夹的条目,或(在主目录之外)在交互式会话中接受该文件夹的信任对话框时,该文件夹即获得已保存的信任。有关此检查适用于哪些服务器,请参阅[在运行 headersHelper 之前信任文件夹](https://code.claude.com/docs/zh-CN/mcp.md#trust-a-folder-before-its-headershelper-runs)。
5916 5950
5917Claude Code 仅在[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中写入此行,每个服务器一次。在交互式会话中,它改为将相同的拒绝写入调试日志。5951Claude Code 仅在[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下写入此行,每个服务器一次。在交互式会话中,它会改为将相同的拒绝信息写入调试日志。
5918 5952
5919```text theme={null}5953```text theme={null}
5920MCP server 'internal-api': headersHelper not run — this workspace has no persisted trust; accept the trust dialog here once interactively, or set projects["/Users/you/project"].hasTrustDialogAccepted in /Users/you/.claude.json.5954MCP server 'internal-api': headersHelper not run — this workspace has no persisted trust; accept the trust dialog here once interactively, or set projects["/Users/you/project"].hasTrustDialogAccepted in /Users/you/.claude.json.
5921```5955```
5922 5956
5923消息打印的 `projects` 键就是[项目允许规则和工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)中说明的 Claude Code 用来记录信任的文件夹。为父文件夹接受信任对话框不满足该检查,`-p` 或 SDK 会话也不满足。5957消息打印的 `projects` 键就是[项目允许规则与工作区信任](https://code.claude.com/docs/zh-CN/permissions.md#project-allow-rules-and-workspace-trust)中所述 Claude Code 用于记录信任的文件夹。接受父文件夹的信任对话框不能满足此检查,`-p` 或 SDK 会话也不能满足。
5924 5958
5925**要做什么:**5959**解决方法:**
5926 5960
5927* 在消息命名的文件夹中运行 `claude`,接受信任对话框,然后再次运行您的 `-p` 或 SDK 命令5961* 在消息指出的文件夹中运行 `claude`,接受信任对话框,然后再次运行您的 `-p` 或 SDK 命令
5928* 在 `~/.claude.json` 中自己设置 `hasTrustDialogAccepted` 条目,使用消息打印的确切 `projects` 键5962* 使用消息打印的确切 `projects` 键,自行在 `~/.claude.json` 中设置 `hasTrustDialogAccepted` 条目
5929* 如果您在主目录中启动了会话,请从您已信任的项目目录工作。当您在主目录中接受信任对话框时,Claude Code 仅为当前会话保持该信任。5963* 如果您是在主目录中启动会话的,请改在已信任的项目目录中工作。当您在主目录中接受信任对话框时,Claude Code 仅在当前会话中保留该信任。
5930 5964
5931### 格式错误的 Tool(content) 规则5965### Malformed Tool(content) rule
5932 5966
5933您的某个设置文件中的[权限规则](https://code.claude.com/docs/zh-CN/permissions.md#permission-rule-syntax)不具有 `Tool` 或 `Tool(content)` 的形式,例如因为右括号后跟有文本或缺少其中一个括号。Claude Code 跳过该规则,并在交互式会话启动时的无效设置对话框中以及 [`claude doctor`](https://code.claude.com/docs/zh-CN/debug-your-config#check-resolved-settings) 输出中列出它:5967您某个设置文件中的[权限规则](https://code.claude.com/docs/zh-CN/permissions.md#permission-rule-syntax)不符合 `Tool` 或 `Tool(content)` 的形式,例如右括号后面还有文本,或缺少其中一个括号。Claude Code 会跳过该规则,并在交互式会话启动时的无效设置对话框以及 [`claude doctor`](https://code.claude.com/docs/zh-CN/debug-your-config#check-resolved-settings) 输出中列出它:
5934 5968
5935```text theme={null}5969```text theme={null}
5936Invalid permission rule "Bash(ls) x" was skipped: Malformed Tool(content) rule. Rules take the form Tool or Tool(content) and must end at the closing ")"; parentheses inside the content are literal5970Invalid permission rule "Bash(ls) x" was skipped: Malformed Tool(content) rule. Rules take the form Tool or Tool(content) and must end at the closing ")"; parentheses inside the content are literal
5937```5971```
5938 5972
5939**要做什么:**5973**解决方法:**
5940 5974
5941* 在消息列出的设置文件中,重写规则使其在其右括号处结束,例如用 `Bash(ls *)` 代替 `Bash(ls) x`5975* 在消息所列的设置文件中重写该规则,使其以右括号结尾,例如用 `Bash(ls *)` 代替 `Bash(ls) x`
5942* 将内容内的括号保留原样。它们是字面量,因此诸如 `Edit(./Finance (2024)/**)` 的规则无需转义即有效5976* 内容中的括号保持原样即可。它们按字面处理,因此 `Edit(./Finance (2024)/**)` 这样的规则无需转义即有效
5943 5977
5944在 v2.1.260 之前,Claude Code 将具有不匹配括号的规则报告为 `Mismatched parentheses`。5978在 v2.1.260 之前,Claude Code 会将括号不匹配的规则报告为 `Mismatched parentheses`。
5945 5979
5946### Matches no tool · check for typos5980### Matches no tool · check for typos
5947 5981
5948启动横幅下方的这一行命名了一条拒绝或询问[权限规则](https://code.claude.com/docs/zh-CN/permissions.md),Claude Code 无法识别其工具名称,因此该规则不适用于您想要的工具。写成 `Bsh` 的拒绝规则不会应用于 Bash,使用工具在会话记录中显示的标签而非其规范名称的规则也不会。该行按您书写的原样重复该规则:5982启动横幅下方的这一行指出某条拒绝或询问[权限规则](https://code.claude.com/docs/zh-CN/permissions.md)的工具名称 Claude Code 无法识别,因此该规则不会应用到您想要的工具上。写成 `Bsh` 的拒绝规则不会应用到 Bash,使用工具在会话记录中显示的标签而非其规范名称的规则也不会生效。该行会按您书写的原样重复该规则:
5949 5983
5950```text theme={null}5984```text theme={null}
5951⚠ Deny rule Bsh matches no tool · check for typos5985⚠ Deny rule Bsh matches no tool · check for typos
5952```5986```
5953 5987
5954在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中,Claude Code 改为在 stderr 上打印较长形式的警告:5988在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,Claude Code 会改为在 stderr 上打印较长形式的警告:
5955 5989
5956```text theme={null}5990```text theme={null}
5957Permission deny rule "Bsh" matches no known tool — check for typos.5991Permission deny rule "Bsh" matches no known tool — check for typos.
5958```5992```
5959 5993
5960**要做什么:**5994**解决方法:**
5961 5995
5962* 更正规则中的工具名称,例如用 `Bash` 代替 `Bsh`。在[工具参考](https://code.claude.com/docs/zh-CN/tools-reference.md)中查找规范名称。5996* 更正规则中的工具名称,例如用 `Bash` 代替 `Bsh`。可在[工具参考](https://code.claude.com/docs/zh-CN/tools-reference.md)中查找规范名称。
5963* 要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。其详情会说明规则的来源,例如 `From project local settings`,或对于 `--disallowedTools` 值显示 `From CLI argument`。5997* 要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。其详情会说明来源,例如 `From project local settings`,或对于 `--disallowedTools` 值显示 `From CLI argument`。
5964* 如果详情显示 `From enterprise managed settings`,请将该行转发给维护您的[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)的人,因为您无法自己更改该规则。5998* 如果详情显示 `From enterprise managed settings`,请将该行转发给负责维护您[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)的人员,因为您无法自行更改该规则。
5965 5999
5966在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中或使用 `--output-format json` 或 `stream-json` 时,Claude Code 将警告写入调试日志而不是 stderr。使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它。6000在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,或使用 `--output-format json` 或 `stream-json` 时,Claude Code 会将警告写入调试日志而不是 stderr。使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它。
5967 6001
5968在 v2.1.305 之前,交互式会话在启动时在 stderr 上打印较长形式,而不是显示该行。6002在 v2.1.305 之前,交互式会话会在启动时于 stderr 上打印较长形式的警告,而不是显示该行。
5969 6003
5970### 不匹配文件权限检查6004### Is not matched by file permission checks
5971 6005
5972Claude Code 在您的某个[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)、[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)或 `--allowedTools`、`--disallowedTools` 或 `--settings` 标志值中找到了带有路径的 `Write`、`NotebookEdit`、`MultiEdit` 或 `Glob` [权限规则](https://code.claude.com/docs/zh-CN/permissions.md#read-and-edit)。它仅针对 `Edit` 和 `Read` 规则检查文件权限,因此从不查询命名其他文件工具之一的路径规则。它保留该规则且不改变其他任何内容。6006Claude Code 在您的某个[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)、[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),或 `--allowedTools`、`--disallowedTools`、`--settings` 标志值中,发现了带路径的 `Write`、`NotebookEdit`、`MultiEdit` 或 `Glob` [权限规则](https://code.claude.com/docs/zh-CN/permissions.md#read-and-edit)。Claude Code 仅根据 `Edit` 和 `Read` 规则检查文件权限,因此永远不会参考指定其他文件工具的路径规则。它会保留该规则,不做其他更改。
5973 6007
5974* **交互式会话**:完整警告写入[调试日志](#configuration-warnings),此形式的拒绝或询问规则还会在启动横幅下方显示为以下行:6008* **交互式会话**:完整警告会写入[调试日志](#configuration-warnings),此类形式的拒绝或询问规则还会在启动横幅下方显示为如下一行:
5975 6009
5976 ```text theme={null}6010 ```text theme={null}
5977 ⚠ Deny rule Write(docs/**) never matches · use Edit(docs/**)6011 ⚠ Deny rule Write(docs/**) never matches · use Edit(docs/**)
5978 ```6012 ```
5979 6013
5980 此形式的允许规则不会显示行。要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。6014 此类形式的允许规则不会显示行。要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。
5981* **使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)**:stderr 上的完整警告命名该规则、括号中的来源以及要写入的替换内容:6015* **使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)**:stderr 上的完整警告会指出规则、括号中的来源以及应写入的替代规则:
5982 6016
5983 ```text theme={null}6017 ```text theme={null}
5984 Permission deny rule (.claude/settings.json): Write(docs/**) is not matched by file permission checks — only Edit(path) rules are. Use Edit(docs/**) instead (Edit rules cover all file-editing tools).6018 Permission deny rule (.claude/settings.json): Write(docs/**) is not matched by file permission checks — only Edit(path) rules are. Use Edit(docs/**) instead (Edit rules cover all file-editing tools).
5985 ```6019 ```
5986* **[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md),或使用 `--output-format json` 或 `stream-json`**:完整警告写入调试日志而不是 stderr,以保持机器读取的输出干净。使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它。6020* **[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md),或使用 `--output-format json` 或 `stream-json`**:完整警告会写入调试日志而不是 stderr,以保持机器读取的输出干净。使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它。
5987 6021
5988**要做什么:**6022**解决方法:**
5989 6023
5990* 将 `Write(path)`、`NotebookEdit(path)` 和旧版 `MultiEdit(path)` 规则替换为 `Edit(path)`。`Edit` 规则涵盖所有文件编辑工具。6024* 将 `Write(path)`、`NotebookEdit(path)` 和旧版 `MultiEdit(path)` 规则替换为 `Edit(path)`。`Edit` 规则涵盖所有文件编辑工具。
5991* 除了在 `--allowedTools` 中(Claude Code 接受 `Glob` 规则而不警告),将 `Glob(path)` 规则替换为 `Read(path)`。6025* 将 `Glob(path)` 规则替换为 `Read(path)`,但在 `--allowedTools` 中除外,Claude Code 在其中接受 `Glob` 规则而不发出警告。
5992* 在完整警告括号中命名的来源处修复规则:设置文件路径,或对于 `--allowed-tools` 和 `--disallowed-tools` 则是标志本身。磁盘上不存在的 `claude-settings-<hash>.json` 路径代表内联 `--settings` 值。请修复您传递给该标志的 JSON。6026* 在规则的来源处修复它,完整警告会在括号中指出来源:设置文件路径,或对于 `--allowed-tools` 和 `--disallowed-tools` 则是标志本身。磁盘上不存在的 `claude-settings-<hash>.json` 路径代表内联的 `--settings` 值。请修复您传给该标志的 JSON。
5993* 将诸如 `Write` 或 `Glob` 的裸工具名称规则保留原样。Claude Code 在[工具级别](https://code.claude.com/docs/zh-CN/permissions.md#match-all-uses-of-a-tool)匹配它们,不对它们发出警告。6027* 不要改动 `Write` 或 `Glob` 等仅含工具名的规则。Claude Code 在[工具级别](https://code.claude.com/docs/zh-CN/permissions.md#match-all-uses-of-a-tool)匹配它们,不会对其发出警告。
5994* 对于来自托管设置的规则,完整警告的括号显示 `managed policy settings`,该规则在 `/permissions` 中的详情显示 `From enterprise managed settings`。请将该警告转发给维护您的托管设置的人,因为您无法自己清除它。6028* 对于来自托管设置的规则,完整警告括号中显示 `managed policy settings`,`/permissions` 中该规则的详情显示 `From enterprise managed settings`。请将该警告转发给负责维护托管设置的人员,因为您无法自行消除它。
5995 6029
5996在 v2.1.210 之前,Claude Code 接受这些规则而不警告。在 v2.1.305 之前,交互式会话在 stderr 上打印完整警告。6030在 v2.1.210 之前,Claude Code 接受这些规则而不发出警告。在 v2.1.305 之前,交互式会话会在 stderr 上打印完整警告。
5997 6031
5998### 在命令的其余部分之前有通配符6032### Has a wildcard before the rest of the command
5999 6033
6000Claude Code 在您的某个[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)、[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)或 `--allowedTools` 或 `--settings` 标志值中找到了一个 `Bash` 允许规则,其 `*` 出现在决定命令类型的后续单词之前,例如 `Bash(git * main)` 或 `Bash(git -C * status *)`。`*` 匹配任何文本,包括在该位置插入的选项:`Bash(git * main)` 也会批准 `git -c core.fsmonitor=<script> diff main`,其中 `-c` 会使 git 运行命令所命名的程序。[通配符模式](https://code.claude.com/docs/zh-CN/permissions.md#wildcard-patterns)显示匹配规则。6034Claude Code 在您的某个[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)、[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md),或 `--allowedTools`、`--settings` 标志值中,发现了一条 `Bash` 允许规则,其 `*` 出现在决定命令身份的后续单词之前,例如 `Bash(git * main)` 或 `Bash(git -C * status *)`。`*` 匹配任意文本,包括插入在该位置的选项:`Bash(git * main)` 也会批准 `git -c core.fsmonitor=<script> diff main`,其中 `-c` 会让 git 运行命令中指定的程序。[通配符模式](https://code.claude.com/docs/zh-CN/permissions.md#wildcard-patterns)介绍了匹配规则。
6001 6035
6002此警告的目的是让您缩小通配符范围超出预期的规则。Claude Code 保留该规则且不改变其匹配方式。在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中,stderr 上的警告命名该规则及括号中的来源:6036此警告的目的是让您收窄通配符范围超出预期的规则。Claude Code 会保留该规则,不改变其匹配方式。在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,stderr 上的警告会指出规则及括号中的来源:
6003 6037
6004```text theme={null}6038```text theme={null}
6005Permission allow rule (.claude/settings.json): Bash(git -C * status *) has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt. For git, options such as -c and --exec-path can run arbitrary commands. Replace that * with the exact value you mean, or only use * after the subcommand (for example Bash(git status *)).6039Permission allow rule (.claude/settings.json): Bash(git -C * status *) has a wildcard before the rest of the command, so it also matches any options inserted at that position and approves them without a prompt. For git, options such as -c and --exec-path can run arbitrary commands. Replace that * with the exact value you mean, or only use * after the subcommand (for example Bash(git status *)).
6006```6040```
6007 6041
6008在交互式会话中,完整警告写入[调试日志](#configuration-warnings),该规则在启动横幅下方显示为以下行:6042在交互式会话中,完整警告会写入[调试日志](#configuration-warnings),该规则会在启动横幅下方显示为如下一行:
6009 6043
6010```text theme={null}6044```text theme={null}
6011⚠ Allow rule Bash(git -C * status *) allows any option at its * · use an exact value6045⚠ Allow rule Bash(git -C * status *) allows any option at its * · use an exact value
6013 6047
6014要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。6048要查找规则的定义位置,请在会话中运行 `/permissions` 并选择该规则。
6015 6049
6016**要做什么:**6050**解决方法:**
6017 6051
6018* 将子命令前的 `*` 替换为您想要的确切值:用 `Bash(git checkout main)` 代替 `Bash(git * main)`。6052* 将子命令之前的 `*` 替换为您想要的确切值:用 `Bash(git checkout main)` 代替 `Bash(git * main)`。
6019* 将每个 `*` 移到子命令后:用 `Bash(git status *)` 代替 `Bash(git -C * status *)`。为您想允许的每个子命令写一条规则。6053* 将所有 `*` 移到子命令之后:用 `Bash(git status *)` 代替 `Bash(git -C * status *)`。为每个要允许的子命令各写一条规则。
6020* 在完整警告括号中命名的来源处修复规则:设置文件路径,或 `--allowed-tools` 标志本身。磁盘上不存在的 `claude-settings-<hash>.json` 路径代表内联 `--settings` 值。请修复您传递给该标志的 JSON。6054* 在规则的来源处修复它,完整警告会在括号中指出来源:设置文件路径,或 `--allowed-tools` 标志本身。磁盘上不存在的 `claude-settings-<hash>.json` 路径代表内联的 `--settings` 值。请修复您传给该标志的 JSON。
6021* 对于来自托管设置的规则,完整警告的括号显示 `managed policy settings`,该规则在 `/permissions` 中的详情显示 `From enterprise managed settings`。请将该警告转发给维护您的托管设置的人,因为您无法自己清除它。6055* 对于来自托管设置的规则,完整警告括号中显示 `managed policy settings`,`/permissions` 中该规则的详情显示 `From enterprise managed settings`。请将该警告转发给负责维护托管设置的人员,因为您无法自行消除它。
6022 6056
6023在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中或使用 `--output-format json` 或 `stream-json` 时,Claude Code 将警告写入调试日志而不是 stderr,以保持机器读取的输出干净。使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它。在 v2.1.246 之前,Claude Code 接受这些规则而不警告。6057在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,或使用 `--output-format json` 或 `stream-json` 时,Claude Code 会将警告写入调试日志而不是 stderr,以保持机器读取的输出干净。使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它。在 v2.1.246 之前,Claude Code 接受这些规则而不发出警告。
6024 6058
6025在 v2.1.305 之前,交互式会话在 stderr 上打印完整警告,而不是显示一行。6059在 v2.1.305 之前,交互式会话会在 stderr 上打印完整警告,而不是显示一行。
6026 6060
6027### 拒绝 Bash 也会关闭 PowerShell 工具6061### Denying Bash also turns off the PowerShell tool
6028 6062
6029您移除了整个 Bash 工具,例如使用 `--disallowedTools Bash`,或在您的某个设置文件中使用裸 `Bash` 或 `Bash(*)` [拒绝规则](https://code.claude.com/docs/zh-CN/permissions.md#match-all-uses-of-a-tool)。在安装了 Git Bash 的 Windows 上,[拒绝 Bash 也会关闭 PowerShell 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#bash-deny-rules-also-turn-off-the-powershell-tool),因此会话启动时没有任何 shell 工具。6063您移除了整个 Bash 工具,例如使用 `--disallowedTools Bash`,或在某个设置文件中使用仅含 `Bash` 或 `Bash(*)` 的[拒绝规则](https://code.claude.com/docs/zh-CN/permissions.md#match-all-uses-of-a-tool)。在安装了 Git Bash 的 Windows 上,[拒绝 Bash 也会关闭 PowerShell 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#bash-deny-rules-also-turn-off-the-powershell-tool),因此会话启动时没有任何 shell 工具。
6030 6064
6031在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中,Claude Code 在启动时在 stderr 上打印此警告,而交互式会话仅将其写入[调试日志](#configuration-warnings):6065在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,Claude Code 会在启动时于 stderr 上打印此警告,而交互式会话只会将其写入[调试日志](#configuration-warnings):
6032 6066
6033```text theme={null}6067```text theme={null}
6034Denying Bash also turns off the PowerShell tool, so Claude has neither. To use PowerShell, set CLAUDE_CODE_USE_POWERSHELL_TOOL=1.6068Denying Bash also turns off the PowerShell tool, so Claude has neither. To use PowerShell, set CLAUDE_CODE_USE_POWERSHELL_TOOL=1.
6035```6069```
6036 6070
6037**要做什么:**6071**解决方法:**
6038 6072
6039* 要让 Claude 使用 PowerShell,请在您的环境中或设置文件的 `env` 块中将 [`CLAUDE_CODE_USE_POWERSHELL_TOOL`](https://code.claude.com/docs/zh-CN/env-vars) 设置为 `1`,如[启用 PowerShell 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#enable-the-powershell-tool)所示。之后 PowerShell 工具会与您的 Bash 拒绝规则并存并保持启用。6073* 要让 Claude 使用 PowerShell,请在您的环境中或设置文件的 `env` 块中将 [`CLAUDE_CODE_USE_POWERSHELL_TOOL`](https://code.claude.com/docs/zh-CN/env-vars) 设为 `1`,如[启用 PowerShell 工具](https://code.claude.com/docs/zh-CN/tools-reference.md#enable-the-powershell-tool)所示。这样 PowerShell 工具会与您的 Bash 拒绝规则同时保持启用。
6040* 要阻止特定命令而不是整个工具,请在同一设置文件或标志中将裸 `Bash` 条目替换为限定范围的规则,例如 `Bash(git push *)`。Claude 会保留 Bash 工具,而 PowerShell 工具会保持关闭,直到您同时设置该变量或添加限定范围的 [`PowerShell` 权限规则](https://code.claude.com/docs/zh-CN/permissions#powershell)。6074* 要阻止特定命令而不是整个工具,请在同一设置文件或标志中,将仅含 `Bash` 的条目替换为有范围的规则,例如 `Bash(git push *)`。Claude 会保留 Bash 工具,而 PowerShell 工具会保持关闭,直到您同时设置该变量或添加有范围的 [`PowerShell` 权限规则](https://code.claude.com/docs/zh-CN/permissions#powershell)。
6041 6075
6042在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中或使用 `--output-format json` 或 `stream-json` 时,Claude Code 将警告写入调试日志而不是 stderr。使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它。在 v2.1.287 之前,Claude Code 以同样的方式关闭 PowerShell 工具,但不打印警告。6076在[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,或使用 `--output-format json` 或 `stream-json` 时,Claude Code 会将警告写入调试日志而不是 stderr。使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它。在 v2.1.287 之前,Claude Code 会以相同方式关闭 PowerShell 工具,但不打印警告。
6043 6077
6044在 v2.1.305 之前,交互式会话也会在启动时在 stderr 上打印该警告。6078在 v2.1.305 之前,交互式会话也会在启动时于 stderr 上打印该警告。
6045 6079
6046### crossSessionInbound 必须是 accept、hold 或 refuse 之一6080### crossSessionInbound must be one of accept, hold, refuse
6047 6081
6048某个设置文件将 [`crossSessionInbound`](https://code.claude.com/docs/zh-CN/settings-reference#crosssessioninbound) 设置为 Claude Code 无法识别的值,例如拼写错误 `"reject"`。警告的第二句取决于哪个文件包含该值;在用户、项目、本地或 `--settings` 文件中,它显示为:6082某个设置文件将 [`crossSessionInbound`](https://code.claude.com/docs/zh-CN/settings-reference#crosssessioninbound) 设为 Claude Code 无法识别的值,例如拼写错误的 `"reject"`。警告的第二句取决于该值所在的文件;在用户、项目、本地或 `--settings` 文件中,警告为:
6049 6083
6050```text theme={null}6084```text theme={null}
6051"crossSessionInbound" must be one of "accept", "hold", "refuse"; received "reject". This value was ignored; while it is present, cross-session messages are held for your approval instead of being delivered. Set it to one of the values above.6085"crossSessionInbound" must be one of "accept", "hold", "refuse"; received "reject". This value was ignored; while it is present, cross-session messages are held for your approval instead of being delivered. Set it to one of the values above.
6052```6086```
6053 6087
6054在[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)中,Claude Code 将无法识别的值视为 `refuse`(最严格的值),警告说明跨会话消息将被拒绝,直到管理员修复它。有关保留行为如何与您的其他设置文件中的值结合,请参阅 [`crossSessionInbound`](https://code.claude.com/docs/zh-CN/settings-reference#crosssessioninbound)。6088在[托管设置](https://code.claude.com/docs/zh-CN/managed-settings.md)中,Claude Code 会将无法识别的值视为最严格的值 `refuse`,警告会说明在管理员修复之前,跨会话消息将被拒收。有关暂存行为如何与您其他设置文件中的值组合,请参阅 [`crossSessionInbound`](https://code.claude.com/docs/zh-CN/settings-reference#crosssessioninbound)。
6055 6089
6056**要做什么:**6090**解决方法:**
6057 6091
6058* 将该键设置为 `"accept"`、`"hold"` 或 `"refuse"`,或删除它6092* 将该键设为 `"accept"`、`"hold"` 或 `"refuse"`,或将其删除
6059* 当警告命名托管设置时,要求管理员修复该值6093* 当警告指出是托管设置时,请让管理员修复该值
6060 6094
6061在 v2.1.248 之前,Claude Code 忽略无法识别的值而不警告。6095在 v2.1.248 之前,Claude Code 会忽略无法识别的值而不发出警告。
6062 6096
6063### ANTHROPIC\_FOUNDRY\_RESOURCE 必须是 Foundry 资源名称6097### ANTHROPIC\_FOUNDRY\_RESOURCE must be a Foundry resource name
6064 6098
6065您将 [`ANTHROPIC_FOUNDRY_RESOURCE`](https://code.claude.com/docs/zh-CN/env-vars) 设置为了裸 [Microsoft Foundry](https://code.claude.com/docs/zh-CN/microsoft-foundry.md) 资源名称以外的内容,例如端点 URL 或其主机名。Claude Code 在发送请求前拒绝了该值。该消息出现在 Claude 回复的位置,而不是作为启动警告:6099您将 [`ANTHROPIC_FOUNDRY_RESOURCE`](https://code.claude.com/docs/zh-CN/env-vars) 设为了单纯的 [Microsoft Foundry](https://code.claude.com/docs/zh-CN/microsoft-foundry.md) 资源名称以外的内容,例如端点 URL 或其主机名。Claude Code 在发送请求之前拒绝了该值。此消息会出现在 Claude 回复的位置,而不是作为启动警告:
6066 6100
6067```text theme={null}6101```text theme={null}
6068API Error: ANTHROPIC_FOUNDRY_RESOURCE must be a Foundry resource name (2-64 letters, digits and hyphens, not starting or ending with a hyphen, such as my-resource), not a URL or host name. To use a full URL, set ANTHROPIC_FOUNDRY_BASE_URL instead.6102API Error: ANTHROPIC_FOUNDRY_RESOURCE must be a Foundry resource name (2-64 letters, digits and hyphens, not starting or ending with a hyphen, such as my-resource), not a URL or host name. To use a full URL, set ANTHROPIC_FOUNDRY_BASE_URL instead.
6069```6103```
6070 6104
6071**要做什么:**6105**解决方法:**
6072 6106
6073* 将 `ANTHROPIC_FOUNDRY_RESOURCE` 仅设置为资源名称,然后重启 Claude Code。对于端点 `https://my-resource.services.ai.azure.com/anthropic`,名称为 `my-resource`。6107* 将 `ANTHROPIC_FOUNDRY_RESOURCE` 仅设为资源名称,然后重启 Claude Code。对于端点 `https://my-resource.services.ai.azure.com/anthropic`,名称为 `my-resource`。
6074* 若要改为提供完整的端点 URL,请将 [`ANTHROPIC_FOUNDRY_BASE_URL`](https://code.claude.com/docs/zh-CN/env-vars) 设置为该 URL 并删除 `ANTHROPIC_FOUNDRY_RESOURCE`,然后重启 Claude Code。Claude Code 只接受这两个变量之一。6108* 若要改为提供完整的端点 URL,请将 [`ANTHROPIC_FOUNDRY_BASE_URL`](https://code.claude.com/docs/zh-CN/env-vars) 设为该 URL 并删除 `ANTHROPIC_FOUNDRY_RESOURCE`,然后重启 Claude Code。Claude Code 只接受这两个变量之一。
6075 6109
6076### 200K 限制未被强制执行6110### The 200K limit isn't enforced
6077 6111
6078您设置了 [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](https://code.claude.com/docs/zh-CN/env-vars),这通常使[自动压缩](https://code.claude.com/docs/zh-CN/model-config.md#default-auto-compact-thresholds)将 1M 上下文模型上的会话保持在 200K 窗口内,但没有压缩阈值将此会话限制在 200K 或以下,因此对话可以超过它。6112您设置了 [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](https://code.claude.com/docs/zh-CN/env-vars),它通常会让[自动压缩](https://code.claude.com/docs/zh-CN/model-config.md#default-auto-compact-thresholds)将使用 1M 上下文模型的会话限制在 200K 窗口内,但没有任何压缩阈值将此会话限制在 200K 或以下,因此对话可能会超出该限制。
6079 6113
6080```text theme={null}6114```text theme={null}
6081CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced for <model>, so this session can grow past it. To enforce it, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 (or the autoCompactWindow setting).6115CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced for <model>, so this session can grow past it. To enforce it, set CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000 (or the autoCompactWindow setting).
6082```6116```
6083 6117
6084Claude Code 会为它识别为具有原生 1M 窗口的每个模型自行强制执行 200K 限制,对于它无法识别的模型 ID,它会在其假设的窗口处压缩。当其他配置使该强制执行失效时,会出现此警告:6118对于 Claude Code 识别为原生具有 1M 窗口的每个模型,Claude Code 会自行强制执行 200K 限制;对于无法识别的模型 ID,它会在其假定的窗口处进行压缩。当其他配置使该强制执行失效时,就会出现此警告:
6085 6119
6086* 模型 ID 不是 Claude Code 能识别的,例如 [LLM 网关](https://code.claude.com/docs/zh-CN/llm-gateway)别名,并且您设置了 [`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1`](https://code.claude.com/docs/zh-CN/env-vars) 或使用 [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](https://code.claude.com/docs/zh-CN/env-vars) 将假设的窗口提高到 200K 以上。在这种情况下,消息还会提供 `or update to a Claude Code version that recognizes <model>` 作为补救措施。6120* 模型 ID 不是 Claude Code 能识别的,例如 [LLM 网关](https://code.claude.com/docs/zh-CN/llm-gateway)别名,并且您设置了 [`CLAUDE_CODE_DISABLE_UNKNOWN_MODEL_WINDOW_ENFORCEMENT=1`](https://code.claude.com/docs/zh-CN/env-vars),或通过 [`CLAUDE_CODE_MAX_CONTEXT_TOKENS`](https://code.claude.com/docs/zh-CN/env-vars) 将假定窗口提高到 200K 以上。在这种情况下,消息还会提供 `or update to a Claude Code version that recognizes <model>` 作为补救措施。
6087* 通过 [`ANTHROPIC_BETAS`](https://code.claude.com/docs/zh-CN/env-vars) 或 [`--betas`](https://code.claude.com/docs/zh-CN/cli-reference#cli-flags) 标志请求的 `context-1m` 测试版仍然会在接受该测试版的模型上向 API 请求 1M 窗口,而没有任何机制在 200K 处压缩会话6121* 通过 [`ANTHROPIC_BETAS`](https://code.claude.com/docs/zh-CN/env-vars) 或 [`--betas`](https://code.claude.com/docs/zh-CN/cli-reference#cli-flags) 标志请求的 `context-1m` beta 仍会在接受该 beta 的模型上向 API 请求 1M 窗口,而没有任何机制在 200K 处压缩会话
6088 6122
6089**要做什么:**6123**解决方法:**
6090 6124
6091* 设置 [`CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000`](https://code.claude.com/docs/zh-CN/env-vars),或将 [`autoCompactWindow`](https://code.claude.com/docs/zh-CN/settings-reference#autocompactwindow) 设置为 `200000`,以便自动压缩在 200K 边界处压缩6125* 设置 [`CLAUDE_CODE_AUTO_COMPACT_WINDOW=200000`](https://code.claude.com/docs/zh-CN/env-vars),或将 [`autoCompactWindow`](https://code.claude.com/docs/zh-CN/settings-reference#autocompactwindow) 设置设为 `200000`,使自动压缩在 200K 边界处压缩
6092* 如果消息命名了此版本无法识别的模型 ID,请运行 `claude update`。能够将该 ID 识别为 1M 上下文模型的版本会强制执行该限制,无需进一步配置。6126* 如果消息指出的是当前版本无法识别的模型 ID,请运行 `claude update`。能将该 ID 识别为 1M 上下文模型的版本会强制执行该限制,无需进一步配置。
6093* 如果您希望会话改为使用模型的完整窗口,请取消设置 `CLAUDE_CODE_DISABLE_1M_CONTEXT`;该警告仅报告 200K 限制未被强制执行6127* 如果您希望会话改为使用模型的完整窗口,请取消设置 `CLAUDE_CODE_DISABLE_1M_CONTEXT`;该警告仅报告 200K 限制未被强制执行
6094 6128
6095在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中,此警告出现在 stderr 上。在交互式会话、[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中或使用 `--output-format json` 或 `stream-json` 时,它改为写入调试日志。使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它。6129在使用文本输出的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,此警告会出现在 stderr 上。在交互式会话、[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,或使用 `--output-format json` 或 `stream-json` 时,它会改为写入调试日志。使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它。
6096 6130
6097在 v2.1.305 之前,交互式会话在启动时在 stderr 上打印该警告。6131在 v2.1.305 之前,交互式会话会在启动时于 stderr 上打印该警告。
6098 6132
6099### 请求上无法识别的模型 ID6133### Unrecognized model ID on a request
6100 6134
6101Claude Code 为您的 Claude Code 版本无法识别的模型 ID 发送了请求,并且找不到将该 ID 映射到它能识别的模型的 [`modelOverrides`](https://code.claude.com/docs/zh-CN/model-config#override-model-ids-per-version) 条目。Claude Code 仍然使用您配置的 ID 发送请求,不会退出或切换模型。6135Claude Code 针对您的 Claude Code 版本无法识别的模型 ID 发送了请求,并且没有找到将该 ID 映射到可识别模型的 [`modelOverrides`](https://code.claude.com/docs/zh-CN/model-config#override-model-ids-per-version) 条目。Claude Code 仍会使用您配置的 ID 发送请求,不会退出或切换模型。
6102 6136
6103```text theme={null}6137```text theme={null}
6104[claude-code:unrecognized_model] {"model":"my-proxy-model","query_source":"sdk"}6138[claude-code:unrecognized_model] {"model":"my-proxy-model","query_source":"sdk"}
6105```6139```
6106 6140
6107在读取 stderr 的脚本或测试工具中,请匹配 `[claude-code:unrecognized_model]` 前缀。在前缀和一个空格之后,Claude Code 写入单行 JSON 对象。Claude Code 可能在更高版本中向其添加字段,因此请忽略任何您未预期的字段。它至少写入以下两个字段:6141在读取 stderr 的脚本或测试框架中,请匹配 `[claude-code:unrecognized_model]` 前缀。在前缀和一个空格之后,Claude Code 会写入一个单行 JSON 对象。Claude Code 可能会在后续版本中向其中添加字段,因此请忽略任何您未预期的字段。它至少会写入以下两个字段:
6108 6142
6109* `model`:您配置的模型字符串6143* `model`:您配置的模型字符串
6110* `query_source`:使用该模型的请求路径。对于 `-p` 运行,Claude Code 报告 `sdk`;对于子代理,报告以 `agent:` 开头的值。6144* `query_source`:使用该模型的请求路径。对于 `-p` 运行,Claude Code 报告 `sdk`;对于子代理,报告以 `agent:` 开头的值。
6111 6145
6112Claude Code 根据您的运行方式将该行写入以下两个位置之一:6146根据运行方式,Claude Code 会将该行写入以下两个位置之一:
6113 6147
6114* 在[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)中使用 `-p` 时,Claude Code 在每种 `--output-format` 下都将其写入 stderr,因此您可以解析 stdout 而无需过滤掉该行6148* 在使用 `-p` 的[非交互模式](https://code.claude.com/docs/zh-CN/headless.md)下,Claude Code 在任何 `--output-format` 下都会将其写入 stderr,因此您无需过滤该行即可解析 stdout
6115* 在交互式会话或[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,Claude Code 改为将其写入调试日志;使用 `--debug` 运行以在 `~/.claude/debug/<session-id>.txt` 处捕获它6149* 在交互式会话或[后台会话](https://code.claude.com/docs/zh-CN/agent-view.md)中,Claude Code 会改为将其写入调试日志;使用 `--debug` 运行可在 `~/.claude/debug/<session-id>.txt` 中捕获它
6116 6150
6117Claude Code 每个进程为每个模型字符串写入该行一次。对于每个其他无法识别的 ID,例如[子代理](https://code.claude.com/docs/zh-CN/sub-agents.md#choose-a-model)或[后台功能](https://code.claude.com/docs/zh-CN/costs.md#background-token-usage)使用的 ID,它会写入单独的一行。6151Claude Code 每个进程对每个模型字符串只写入一次该行。对于其他每个无法识别的 ID,例如[子代理](https://code.claude.com/docs/zh-CN/sub-agents.md#choose-a-model)或[后台功能](https://code.claude.com/docs/zh-CN/costs.md#background-token-usage)使用的 ID,它会单独写入一行。
6118 6152
6119对于它能解析为可识别模型的提供商 ID,Claude Code 不写入该行,例如 Amazon Bedrock `us.anthropic.claude-...` ID、带有 `@` 版本后缀的 Google Cloud Agent Platform ID,以及包含 Claude 模型 ID 的 Microsoft Foundry 部署名称。Claude Code 检查 Amazon Bedrock [应用推理配置文件 ARN](https://code.claude.com/docs/zh-CN/amazon-bedrock.md#map-each-model-version-to-an-inference-profile) 背后的模型,而不是 ARN 本身。对于无法解析的 ARN(例如拼写错误的 ARN),它不写入任何行。6153对于能解析到可识别模型的提供商 ID,Claude Code 不会写入该行,例如 Amazon Bedrock 的 `us.anthropic.claude-...` ID、带有 `@` 版本后缀的 Google Cloud Agent Platform ID,以及包含 Claude 模型 ID 的 Microsoft Foundry 部署名称。对于 Amazon Bedrock [应用推理配置文件 ARN](https://code.claude.com/docs/zh-CN/amazon-bedrock.md#map-each-model-version-to-an-inference-profile),Claude Code 检查的是其背后的模型,而不是 ARN 本身。对于无法解析的 ARN(例如输入错误的 ARN),它不会写入任何行。
6120 6154
6121**要做什么:**6155**解决方法:**
6122 6156
6123* 如果您是有意设置该 ID 的,例如 [LLM 网关](https://code.claude.com/docs/zh-CN/llm-gateway)别名,请在您的[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)中添加一个以该 ID 为值的 [`modelOverrides`](https://code.claude.com/docs/zh-CN/model-config#override-model-ids-per-version) 条目。使用 Anthropic 模型 ID 作为键,而不是诸如 `opus` 的系列别名。对于示例行中的 `my-proxy-model`,添加此条目:6157* 如果您是有意设置该 ID 的,例如 [LLM 网关](https://code.claude.com/docs/zh-CN/llm-gateway)别名,请在您的[设置文件](https://code.claude.com/docs/zh-CN/settings.md#where-settings-live)中添加一个 [`modelOverrides`](https://code.claude.com/docs/zh-CN/model-config#override-model-ids-per-version) 条目,以该 ID 作为值。请使用 Anthropic 模型 ID 作为键,而不是 `opus` 等系列别名。对于示例行中的 `my-proxy-model`,请添加以下条目:
6124 6158
6125 ```json theme={null}6159 ```json theme={null}
6126 {6160 {
6130 }6164 }
6131 ```6165 ```
6132 6166
6133 然后 Claude Code 会将 `my-proxy-model` 视为 `claude-opus-4-6` 并停止写入该行。6167 之后,Claude Code 会将 `my-proxy-model` 视为 `claude-opus-4-6`,并停止写入该行。
6134 6168
6135* 如果该 ID 命名的模型比您的 Claude Code 版本更新,请运行 `claude update`6169* 如果该 ID 指的是比您的 Claude Code 版本更新的模型,请运行 `claude update`
6136 6170
6137* 如果该 ID 是拼写错误,请在包含它的[可设置模型的位置](https://code.claude.com/docs/zh-CN/model-config.md#setting-your-model)或[别名变量](https://code.claude.com/docs/zh-CN/model-config.md#environment-variables)中修复它。如果 `query_source` 以 `agent:` 开头,请改为在您设置[子代理模型](https://code.claude.com/docs/zh-CN/sub-agents.md#choose-a-model)的地方修复它。6171* 如果该 ID 是拼写错误,请在保存它的[可设置模型的位置](https://code.claude.com/docs/zh-CN/model-config.md#setting-your-model)或[别名变量](https://code.claude.com/docs/zh-CN/model-config.md#environment-variables)中修正。如果 `query_source` 以 `agent:` 开头,请改为在设置[子代理模型](https://code.claude.com/docs/zh-CN/sub-agents.md#choose-a-model)的位置修正。
6138 6172
6139在 v2.1.233 之前,Claude Code 在为无法识别的模型 ID 发送请求时不写入任何行。6173在 v2.1.233 之前,Claude Code 在针对无法识别的模型 ID 发送请求时不会写入任何行。
6140 6174
6141### 托管锁定下沙箱允许条目被忽略6175### Sandbox allow entries are ignored under a managed lock
6142 6176
6143`/status` 和 `claude doctor` 中的此警告表示托管设置设置了 [`allowManagedReadPathsOnly`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-filesystem-allowmanagedreadpathsonly) 或 [`allowManagedDomainsOnly`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-network-allowmanageddomainsonly),因此该警告所命名文件中的 [`allowRead`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-filesystem-allowread) 或 [`allowedDomains`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-network-alloweddomains) 条目不适用:6177`/status` 和 `claude doctor` 中的此警告表示托管设置设置了 [`allowManagedReadPathsOnly`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-filesystem-allowmanagedreadpathsonly) 或 [`allowManagedDomainsOnly`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-network-allowmanageddomainsonly),因此警告所指文件中的 [`allowRead`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-filesystem-allowread) 或 [`allowedDomains`](https://code.claude.com/docs/zh-CN/settings-reference#sandbox-network-alloweddomains) 条目不会生效:
6144 6178
6145```text wrap theme={null}6179```text wrap theme={null}
6146sandbox.filesystem.allowRead is ignored — managed settings set allowManagedReadPathsOnly, so only allowRead paths from managed settings are honored. The 3 entries in /home/you/.claude/settings.json will NOT apply (see https://code.claude.com/docs/en/settings#sandbox-settings).6180sandbox.filesystem.allowRead is ignored — managed settings set allowManagedReadPathsOnly, so only allowRead paths from managed settings are honored. The 3 entries in /home/you/.claude/settings.json will NOT apply (see https://code.claude.com/docs/en/settings#sandbox-settings).
6147```6181```
6148 6182
6149对于网络锁定,警告命名 `sandbox.network.allowedDomains` 和 `allowManagedDomainsOnly`,并显示 `only allowed domains (and WebFetch domain rules) from managed settings are honored`。6183对于网络锁定,警告会指出 `sandbox.network.allowedDomains` 和 `allowManagedDomainsOnly`,并说明 `only allowed domains (and WebFetch domain rules) from managed settings are honored`。
6150 6184
6151**要做什么:**6185**解决方法:**
6152 6186
6153* 您不必对该警告采取行动6187* 您无需对此警告采取行动
6154* 如果您需要这些路径或域,而您组织的托管设置设置了该锁定,请要求您的管理员将它们添加到这些设置中。在您同时从所命名的文件中删除这些条目之前,警告会一直存在。6188* 如果您需要这些路径或域名,且是组织的托管设置设置了该锁定,请让管理员将它们添加到这些设置中。在您同时从所指文件中删除这些条目之前,警告会一直存在。
6155* 要清除警告,请从所命名的文件中删除这些条目。对于您共享的文件,例如项目的 `.claude/settings.json`,您可以为没有该锁定的团队成员保留这些条目,并让警告继续显示。6189* 要消除警告,请从所指文件中删除这些条目。对于共享的文件(例如项目的 `.claude/settings.json`),您可以为没有该锁定的团队成员保留这些条目,并让警告继续显示。
6156 6190
6157### Sandbox mask files left behind at write-deny paths6191### Sandbox mask files left behind at write-deny paths
6158 6192
6159`claude doctor` 和 `/status` 中的此警告列出掩码文件:位于[沙箱](https://code.claude.com/docs/zh-CN/sandboxing.md)拒绝写入的路径上的 0 字节只读占位符文件。当启用了沙箱隔离并打开文件系统隔离时,它会在 Linux 和 WSL2 上出现。在包含这些文件的项目中没有打开任何 Claude Code 会话后,请从 shell 中删除它们。6193`claude doctor` 和 `/status` 中的此警告会列出掩码文件:位于[沙箱](https://code.claude.com/docs/zh-CN/sandboxing.md)拒绝写入的路径上的 0 字节只读占位文件。在 Linux 和 WSL2 上启用沙箱隔离且开启文件系统隔离时会出现此警告。当包含这些文件的项目中没有打开任何 Claude Code 会话时,请从 shell 中删除它们。
6160 6194
6161沙箱在沙箱中的命令运行时创建占位符,并在命令结束时将其删除。在以下情况下会留下占位符:6195沙箱会在沙箱化命令运行时创建占位文件,并在命令结束时将其删除。在以下情况下,占位文件会残留:
6162 6196
6163* 会话在命令结束前被终止,例如通过 SIGKILL6197* 会话在命令结束前被终止,例如被 SIGKILL 终止
6164* 您在沙箱中的命令仍在运行时退出了会话,例如在后台运行的命令6198* 您在沙箱化命令仍在运行时退出了会话,例如后台运行的命令
6165 6199
6166在 `claude doctor` 中,警告显示为:6200在 `claude doctor` 中,警告为:
6167 6201
6168```text theme={null}6202```text theme={null}
6169- Sandbox mask files left behind at write-deny paths: /home/you/project/.claude/settings.local.json6203- Sandbox mask files left behind at write-deny paths: /home/you/project/.claude/settings.local.json
6170 Fix: A session leaves one where it was killed, or where it exited while a sandboxed command was still running. Remove each with `rm <path>` while no other Claude Code session is running in that project — a 0-byte read-only file where a settings file belongs makes "Yes, and don't ask again" fail to save, and the sandbox binds it read-only again on every start6204 Fix: A session leaves one where it was killed, or where it exited while a sandboxed command was still running. Remove each with `rm <path>` while no other Claude Code session is running in that project — a 0-byte read-only file where a settings file belongs makes "Yes, and don't ask again" fail to save, and the sandbox binds it read-only again on every start
6171```6205```
6172 6206
6173**要做什么:**6207**解决方法:**
6174 6208
6175* 退出在包含所列文件的项目中打开的每个 Claude Code 会话(包括 `/status` 显示该警告的任何会话),然后在 shell 中操作。另一个会话的沙箱仍在使用的占位符是该会话写入保护的有效组成部分6209* 退出包含所列文件的项目中打开的所有 Claude Code 会话(包括 `/status` 显示该警告的任何会话),然后在 shell 中操作。另一个会话的沙箱仍在使用的占位文件是该会话写入保护中正在生效的一部分
6176* 在 shell 中,使用 `rm` 删除每个列出的文件,如果 `rm` 询问是否删除写保护文件,请确认。警告最多命名三个文件并对其余文件计数,因此删除后请再次运行 `claude doctor`,直到警告不再出现6210* 在 shell 中使用 `rm` 删除列出的每个文件,如果 `rm` 询问是否删除写保护文件,请确认。警告最多列出三个文件并统计其余数量,因此删除后请再次运行 `claude doctor`,直到警告不再出现
6177* 如果您使用"是,不要再问"保存的权限选择没有生效,请在删除占位符后再次保存6211* 如果您通过 "Yes, and don't ask again" 保存的权限选择没有生效,请在删除占位文件后重新保存
6178 6212
6179在 v2.1.309 之前,该警告显示为 `Stale sandbox mask files left by a killed session`。6213在 v2.1.309 之前,该警告显示为 `Stale sandbox mask files left by a killed session`。
6180 6214
6181在 v2.1.257 之前,`claude doctor` 不会标记这些文件;较早的版本在会话被终止时会留下相同的占位符。6215在 v2.1.257 之前,`claude doctor` 不会标记这些文件;当会话被终止时,更早的版本也会留下相同的占位文件。
6182 6216
6183## 回复质量似乎低于预期6217## 回复质量似乎低于预期
6184 6218