diff --git a/zh-CN/errors.md b/zh-CN/errors.md
index ed7a4cddd66e40396eb6ddabc1bbe8b54d08c1ff..b18afc537164fe2eeba8f6656af955154eec5815 100644
--- a/zh-CN/errors.md
+++ b/zh-CN/errors.md
@@ -6,147 +6,400 @@
> 查找 Claude Code 运行时错误消息,了解每个错误的含义以及如何修复。
-本页列出了 Claude Code 显示的运行时错误以及如何从每个错误中恢复,以及当响应似乎有问题但没有错误时要检查的内容。对于安装错误(如 `command not found` 或设置期间的 TLS 故障),请参阅[故障排除安装和登录](/docs/zh-CN/troubleshoot-install)。
+本页列出 Claude Code 显示的运行时错误以及如何从每个错误中恢复,以及当响应似乎有问题但没有错误时要检查的内容。对于安装错误(如 `command not found` 或设置期间的 TLS 失败),请参阅[排查安装和登录问题](/docs/zh-CN/troubleshoot-install)。
-这些错误和恢复命令适用于 CLI、[桌面应用](/docs/zh-CN/desktop)和[网络上的 Claude Code](/docs/zh-CN/claude-code-on-the-web),因为这三个都包装了相同的 Claude Code CLI。对于特定于表面的问题,请参阅该表面页面上的故障排除部分。
+除了[包装器和 IDE 错误](#wrapper-and-ide-errors)(由启动程序打印而不是 Claude Code 本身打印)外,这些错误和恢复命令适用于 CLI、[桌面应用](/docs/zh-CN/desktop)和[云会话](/docs/zh-CN/claude-code-on-the-web),因为这三个都包装相同的 Claude Code CLI。对于其他表面特定的问题,请参阅该表面页面上的故障排除部分。
- Claude Code 调用 Claude API 获取模型响应,因此大多数运行时错误映射到底层 API 错误代码。本页介绍了每个错误在 Claude Code 中的含义以及如何恢复。有关原始 HTTP 状态代码定义,请参阅 [Claude Platform 错误参考](https://platform.claude.com/docs/en/api/errors)。
+ Claude Code 调用 Claude API 来获取模型响应,因此大多数运行时错误映射到底层 API 错误代码。本页介绍每个错误在 Claude Code 中的含义以及如何恢复。有关原始 HTTP 状态代码定义,请参阅 [Claude Platform 错误参考](https://platform.claude.com/docs/en/api/errors)。
查找您的错误
-将您在终端中看到的消息与下面的部分相匹配。
+将您看到的消息与下面的部分相匹配。
| 消息 | 部分 |
-| :------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------- |
+| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------- |
| `API Error: 500 Internal server error` | [服务器错误](#api-error-500-internal-server-error) |
| `API Error: Repeated 529 Overloaded errors` | [服务器错误](#api-error-repeated-529-overloaded-errors) |
-| `Request timed out` | [服务器错误](#request-timed-out),或[网络](#unable-to-connect-to-api)(如果消息提到您的互联网连接) |
+| `Request timed out` | [服务器错误](#request-timed-out),或如果消息提到您的互联网连接,则为[网络](#unable-to-connect-to-api) |
+| `API Error: No response from API` | [服务器错误](#no-response-from-api) |
| `Server error mid-response. The response above may be incomplete.` | [服务器错误](#the-response-above-may-be-incomplete) |
+| `Connection lost mid-response` / `Your computer went to sleep mid-response` / `The response stopped arriving` | [服务器错误](#the-response-above-may-be-incomplete) |
| `Connection closed mid-response` / `Response stalled mid-stream` | [服务器错误](#the-response-above-may-be-incomplete) |
+| `Connection lost before a response was produced` / `Your computer went to sleep before a response was produced` / `The response stalled before a response was produced` | [自动重试](#automatic-retries) |
+| `Connection closed while thinking` / `Response stalled while thinking` | [自动重试](#automatic-retries) |
+| `Connection lost while your computer was asleep` | [自动重试](#automatic-retries) |
| ` is temporarily unavailable, so auto mode cannot determine the safety of...` | [服务器错误](#auto-mode-cannot-determine-the-safety-of-an-action) |
| `Auto mode could not evaluate this action and is blocking it for safety` | [服务器错误](#auto-mode-cannot-determine-the-safety-of-an-action) |
| `Auto mode classifier transcript exceeded context window` | [服务器错误](#auto-mode-cannot-determine-the-safety-of-an-action) |
+| `Agent aborted: auto mode classifier request refused by the safety safeguard` | [服务器错误](#auto-mode-cannot-determine-the-safety-of-an-action) |
+| `The server-side auto mode classifier gave no verdict` | [服务器错误](#the-server-returned-no-safety-verdict) |
+| `Auto mode is unavailable — the server returned no safety verdict for the last 10 responses` | [服务器错误](#the-server-returned-no-safety-verdict) |
| `Agent terminated early due to an API error` | [服务器错误](#agent-terminated-early-due-to-an-api-error) |
-| `You've hit your session limit` / `You've hit your weekly limit` | [使用限制](#youve-hit-your-session-limit) |
+| `You've hit your session limit` / `You've hit your weekly limit` / `You've hit your Opus limit` / `You've hit your Sonnet limit` | [使用限制](#youve-hit-your-session-limit) |
| `Usage credits required for 1M context` | [使用限制](#usage-credits-required-for-1m-context) |
+| `the prompt to confirm went unanswered — nothing was sent` | [使用限制](#the-prompt-to-confirm-went-unanswered) |
| `Server is temporarily limiting requests` | [使用限制](#server-is-temporarily-limiting-requests) |
| `Request rejected (429)` | [使用限制](#request-rejected-429) |
| `Credit balance is too low` | [使用限制](#credit-balance-is-too-low) |
+| `You've hit your monthly spend limit` / `You've hit your individual spend limit` / `You've hit your org's monthly spend limit` / `You've hit your channel's monthly spend limit` / `You've hit your team's shared budget` / `You've hit your individual usage limit` | [使用限制](#youve-hit-your-monthly-spend-limit) |
+| `Could not update your spend limit` | [使用限制](#could-not-update-your-spend-limit) |
+| `spend limit reached` / `spend limit unavailable` | [使用限制](#spend-limit-reached) |
| `Not logged in · Please run /login` | [身份验证](#not-logged-in) |
| `Could not resolve authentication method` | [身份验证](#could-not-resolve-authentication-method) |
| `Invalid API key` | [身份验证](#invalid-api-key) |
| `Your apiKeyHelper script is failing` | [身份验证](#your-apikeyhelper-script-is-failing) |
+| `Invalid auth token · Fix external auth token` | [身份验证](#invalid-request-header-value) |
+| `Invalid ANTHROPIC_CUSTOM_HEADERS · Fix the environment variable` | [身份验证](#invalid-request-header-value) |
+| `Invalid request header from the environment · Fix the environment variable` | [身份验证](#invalid-request-header-value) |
| `This organization has been disabled` | [身份验证](#this-organization-has-been-disabled) |
| `Your organization has disabled API key authentication` | [身份验证](#your-organization-has-disabled-api-key-authentication) |
| `Your organization has disabled Claude subscription access` | [身份验证](#your-organization-has-disabled-claude-subscription-access) |
| `Routines are disabled by your organization's policy` | [身份验证](#routines-are-disabled-by-your-organizations-policy) |
| `Remote Control is only available when using Claude via api.anthropic.com` | [身份验证](#remote-control-requires-the-anthropic-api) |
+| `OAuth token refresh failed — run /login to re-authenticate` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `JWT refresh failed: no OAuth token — run /login` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `Claude.ai login expired` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `Claude.ai login was rejected — run /login, then /remote-control` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `OAuth token unavailable — run /login to restore Remote Control` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `Signed out of Claude — run /login, then /remote-control` | [身份验证](#remote-control-couldnt-refresh-your-login) |
+| `signed-in claude.ai account or organization changed on this machine` | [身份验证](#remote-control-stopped-because-the-signed-in-account-changed) |
+| `Remote Control stopped — the app running this session is now signed in to a different Claude account` | [身份验证](#remote-control-stopped-because-the-app-running-the-session-signed-out-or-switched-accounts) |
+| `Remote Control stopped — the app running this session is signed out of Claude` | [身份验证](#remote-control-stopped-because-the-app-running-the-session-signed-out-or-switched-accounts) |
| `OAuth token revoked` / `OAuth token has expired` | [身份验证](#oauth-token-revoked-or-expired) |
+| `API Error: 401 Invalid authentication credentials` | [身份验证](#api-error-401-invalid-authentication-credentials) |
| `Login expired · Please run /login` | [身份验证](#login-expired) |
+| `Claude login not accepted · Run /login, then try again` | [身份验证](#claude-login-not-accepted) |
+| `Artifacts need a claude.ai login` | [身份验证](#artifacts-need-a-claude-ai-login) |
+| `Not signed in to the Cloud gateway — run /login.` | [身份验证](#administrator-policy-requires-a-cloud-gateway-sign-in) |
+| `Administrator policy requires a Cloud gateway sign-in on this machine` | [身份验证](#administrator-policy-requires-a-cloud-gateway-sign-in) |
| `Failed to authenticate: OAuth session expired and could not be refreshed` | [身份验证](#login-expired) |
+| `Your account is on hold and can't use Claude Code. View details or appeal: https://claude.ai/restricted` | [身份验证](#your-account-is-on-hold) |
+| `Your account is on hold and can't sign in to Claude Code. View details or appeal: https://claude.ai/restricted` | [身份验证](#your-account-is-on-hold) |
+| `Anthropic profile login expired · Re-authenticate your Anthropic profile` | [身份验证](#anthropic-profile-login-expired) |
+| `Anthropic profile login expired · Run /login to use your claude.ai account instead, or re-authenticate the profile` | [身份验证](#anthropic-profile-login-expired) |
| `does not meet scope requirement user:profile` | [身份验证](#oauth-scope-requirement) |
+| `claude.ai rejected the session token` / `session token rejected` | [身份验证](#claude-ai-rejected-the-session-token) |
+| `MCP server "" needs you to sign in again (run /mcp to re-authenticate)` | [身份验证](#mcp-server-needs-you-to-sign-in-again) |
+| `rejected the credential from its headersHelper` / `rejected the Authorization header in its config` | [身份验证](#mcp-server-needs-you-to-sign-in-again) |
+| `MCP server "" needs additional permissions (scope: "") — run /mcp to re-authenticate` | [身份验证](#mcp-server-needs-you-to-sign-in-again) |
+| `MCP server "" requires re-authorization (token expired)` | [身份验证](#mcp-server-needs-you-to-sign-in-again) |
+| `Issuer mismatch in authorization response (RFC 9207)` | [身份验证](#issuer-mismatch-in-authorization-response) |
+| `Cloud gateway session expired — run /login to reconnect.` | [身份验证](#cloud-gateway-session-expired) |
+| `Cloud gateway no longer accepts this session` | [身份验证](#cloud-gateway-session-expired) |
+| `Sign-in timed out while waiting for you to continue. Try again.` | [身份验证](#sign-in-timed-out-while-waiting-for-you-to-continue) |
| `AWS credentials expired or invalid` | [身份验证](#aws-credentials-expired-or-invalid) |
| `AWS authentication failed` | [身份验证](#aws-authentication-failed) |
+| `Google Cloud credentials expired or invalid` | [身份验证](#google-cloud-credentials-expired-or-invalid) |
+| `Google Cloud authentication failed` | [身份验证](#google-cloud-authentication-failed) |
+| `Microsoft Foundry authentication failed` | [身份验证](#microsoft-foundry-authentication-failed) |
+| `Gateway refused the request` | [身份验证](#gateway-refused-the-request) |
+| `Could not load AWS credentials` / `Could not load Google Cloud credentials` | [身份验证](#could-not-load-aws-or-google-cloud-credentials) |
| `AWS default-chain credential resolve timed out` | [身份验证](#aws-default-chain-credential-resolve-timed-out) |
+| `Timed out after 60s waiting for AWS` | [身份验证](#bedrock-setup-verification-timed-out-waiting-for-aws) |
+| `A request to AWS timed out. Check your network and proxy settings, then try again.` | [身份验证](#bedrock-setup-verification-timed-out-waiting-for-aws) |
+| `Could not load the default credentials` on Google Cloud's Agent Platform | [身份验证](#could-not-load-aws-or-google-cloud-credentials) |
| `Unable to connect to API` | [网络](#unable-to-connect-to-api) |
-| `Waiting for API response · will retry in` | [自动重试](#automatic-retries),或[网络](#unable-to-connect-to-api)(如果问题持续) |
+| `Connection refused —` / `Can't reach the API server —` / `No internet route —` / `Couldn't connect through your proxy` / `Connection dropped`,每个都带有括号中的错误代码 | [网络](#unable-to-connect-to-api) |
+| `Unable to connect to Anthropic services` during setup | [网络](#unable-to-connect-to-anthropic-services) |
+| `Socket is closed` | [网络](#socket-is-closed) |
+| `Waiting for API response · will retry in` | [自动重试](#automatic-retries),或如果持续存在,则为[网络](#unable-to-connect-to-api) |
+| `API returned an empty or malformed response` | [网络](#api-returned-an-empty-or-malformed-response) |
+| `Streaming response ended before any complete data was received` | [网络](#streaming-response-ended-before-any-complete-data-was-received) |
| `Bedrock streaming response has content-type "..."; expected "application/vnd.amazon.eventstream"` | [网络](#bedrock-streaming-response-has-an-unexpected-content-type) |
| `SSL certificate verification failed` | [网络](#ssl-certificate-errors) |
| `SSL certificate error (...)` during login or startup | [网络](#ssl-certificate-errors) |
+| `unable to get local issuer certificate` | [网络](#ssl-certificate-errors) |
| `403` with `x-deny-reason: host_not_allowed` in a cloud or routine session | [网络](#host-not-allowed-in-a-cloud-session) |
+| `proxy refused the connection` | [网络](#the-proxy-refused-the-connection) |
+| `403` with `This GraphQL query is not enabled for this session` in a cloud session | [GitHub proxy](/docs/zh-CN/cloud-environments#github-proxy) |
+| `The cloud environments service returned an empty response` / `The cloud environments service returned a response in an unexpected format` | [网络](#the-cloud-environments-service-returned-an-empty-or-unexpected-response) |
| `Couldn't reconnect to your Remote Control session` | [网络](#couldnt-reconnect-to-your-remote-control-session) |
-| `Prompt is too long` | [请求错误](#prompt-is-too-long) |
+| `N sessions ended while this machine was offline — the environment was cleaned up on the server and can't be resumed.` | [网络](#sessions-ended-while-this-machine-was-offline) |
+| `Couldn't share the transcript.` | [网络](#couldnt-share-the-transcript) |
+| `Prompt is too long` / `Input is too long for requested model` | [请求错误](#prompt-is-too-long) |
+| `Prompt is too long · automatic compaction failed:` | [请求错误](#prompt-is-too-long) |
+| `Prompt is too long · this conversation is a single exchange` / `A single-exchange conversation cannot be compacted` | [请求错误](#prompt-is-too-long) |
+| `Context limit reached · /compact or /clear to continue` | [请求错误](#prompt-is-too-long) |
+| `Context limit reached · /clear to continue` | [请求错误](#prompt-is-too-long) |
+| `capability_rejected: prompt_too_long` on a Claude apps gateway session | [请求错误](#prompt-is-too-long) |
+| `upstream rejected the request` / `request too large for this upstream` on a Claude apps gateway session | [上游错误消息](/docs/zh-CN/claude-apps-gateway-config#upstream-error-messages) |
+| `upstream rate limit exceeded` on a Claude apps gateway session | [上游错误消息](/docs/zh-CN/claude-apps-gateway-config#upstream-error-messages) |
+| `all upstreams failed (N attempted)` on a Claude apps gateway session | [上游错误消息](/docs/zh-CN/claude-apps-gateway-config#upstream-error-messages) |
+| `Claude Code may not be enabled for your organization` after a Claude apps gateway sign-in | [Claude apps gateway 故障排除](/docs/zh-CN/claude-apps-gateway-deploy#troubleshooting) |
+| `Context exceeds the ...-token limit by ... tokens` in `/context` output | [请求错误](#context-exceeds-the-token-limit) |
| `Error during compaction: Conversation too long` | [请求错误](#error-during-compaction-conversation-too-long) |
| `Request too large` | [请求错误](#request-too-large) |
+| `Request too large for the API's 32MB request limit` | [请求错误](#request-too-large) |
| `Image was too large` | [请求错误](#image-was-too-large) |
| `Unable to resize image` | [请求错误](#unable-to-resize-image) |
| `PDF too large` / `PDF is password protected` | [请求错误](#pdf-errors) |
| `Extra inputs are not permitted` | [请求错误](#extra-inputs-are-not-permitted) |
+| `API Error: 400 ... tools.N.custom.input_schema: JSON schema is invalid` / `Property keys should match pattern` | [请求错误](#tool-input-schema-is-invalid) |
| `There's an issue with the selected model` | [请求错误](#theres-an-issue-with-the-selected-model) |
| `Model ... is not a recognized model id` | [请求错误](#model-is-not-a-recognized-model-id) |
+| `Model ... not found` | [请求错误](#model-not-found) |
| `Claude Opus is not available with the Claude Pro plan` | [请求错误](#claude-opus-is-not-available-with-the-claude-pro-plan) |
+| `Claude Code ... does not support this model; version ... or newer is required` | [请求错误](#claude-code-does-not-support-this-model) |
+| `Claude Code ... is older than the minimum version required by your organization's policy` | [请求错误](#claude-code-does-not-support-this-model) |
| `Model ... is restricted by your organization's settings` | [请求错误](#model-is-restricted-by-your-organizations-settings) |
+| `Model switch ... blocked by a PreModelSwitch hook` | [请求错误](#model-switch-was-blocked-by-a-premodelswitch-hook) |
+| `couldn't save it as your default` / `couldn't confirm it was saved as your default` | [请求错误](#couldnt-save-it-as-your-default) |
| `thinking.type.enabled is not supported for this model` | [请求错误](#thinking-type-enabled-is-not-supported-for-this-model) |
+| `Effort '' isn't available with thinking turned off on this model` | [请求错误](#effort-isnt-available-with-thinking-turned-off) |
+| `effort '' is not supported when thinking is disabled` | [请求错误](#effort-isnt-available-with-thinking-turned-off) |
| `max_tokens must be greater than thinking.budget_tokens` | [请求错误](#thinking-budget-exceeds-output-limit) |
| `API Error: 400 due to tool use concurrency issues` | [请求错误](#tool-use-or-thinking-block-mismatch) |
+| `API Error: 400 orphaned tool_result in conversation history` | [请求错误](#tool-use-or-thinking-block-mismatch) |
+| `API Error: 400 duplicate tool_use ID in conversation history` | [请求错误](#tool-use-or-thinking-block-mismatch) |
+| `[Unsupported tool content removed]` | [请求错误](#unsupported-tool-content-removed) |
+| `role 'system' must precede an 'assistant' message` | [请求错误](#role-system-must-precede-an-assistant-message) |
+| `Invalid encrypted_content in search_result block` / `Invalid encrypted_index in text block` / `Failed to decrypt web search result content` | [请求错误](#invalid-encrypted-content-in-search-result-block) |
+| `server_tool_use.name: Input should be` on every turn of a resumed session | [请求错误](#unsupported-tool-content-removed) |
+| ` can't help with this. Start a new session to continue` | [请求错误](#usage-policy-refusal) |
| `Claude Code is unable to respond to this request, which appears to violate our Usage Policy` | [请求错误](#usage-policy-refusal) |
+| `'s safeguards flagged this message` | [请求错误](#safety-measures-flagged-a-cybersecurity-topic) |
+| `Opus 5.5's safeguards flagged this session` | [请求错误](#safety-measures-flagged-a-cybersecurity-topic) |
| ` has safety measures that flagged this message for a cybersecurity topic` | [请求错误](#safety-measures-flagged-a-cybersecurity-topic) |
| `Installation was killed before it could finish (exit code 137)` | [安装错误](#installation-was-killed-before-it-could-finish) |
| `The connection dropped while downloading the update` | [安装错误](#the-connection-dropped-while-downloading-the-update) |
| `Download timed out: exceeded the total deadline` | [安装错误](#the-connection-dropped-while-downloading-the-update) |
| `--bg and --print conflict` | [命令行错误](#command-line-errors) |
+| `Cloud sessions cannot be created from a --restricted session` | [命令行错误](#cloud-sessions-cannot-be-created-from-a-restricted-session) |
+| `Cloud sessions are disabled by your organization's policy` | [命令行错误](#cloud-sessions-are-disabled-by-your-organizations-policy) |
+| `Couldn't verify your organization's policy for cloud sessions` | [命令行错误](#cloud-sessions-are-disabled-by-your-organizations-policy) |
| `Error: --json-schema is not a valid JSON Schema` | [命令行错误](#command-line-errors) |
+| `Error: Invalid --agents configuration:` | [命令行错误](#invalid-agents-configuration) |
+| `Error: Settings file exceeds the 2MiB limit` | [命令行错误](#settings-file-exceeds-the-2mib-limit) |
+| `The current directory no longer exists (it was deleted or moved)` / `Can't read the current directory` | [命令行错误](#the-current-directory-no-longer-exists) |
+| `Temp directory ... Refusing to use it` / `ENOSPC: no space left on device, mkdir ''` | [命令行错误](#temp-directory-refused-or-cannot-be-created) |
+| `couldn't be resolved to a real location, so its skills, commands, and agents weren't loaded` | [命令行错误](#directory-couldnt-be-resolved-to-a-real-location) |
+| `Error: Workspace not trusted` when starting Remote Control | [命令行错误](#workspace-not-trusted-when-starting-remote-control) |
+| `` `` before `remote-control` is not carried over to the sessions Remote Control starts `` | [命令行错误](#not-carried-over-to-the-sessions-remote-control-starts) |
+| `` `claude import` is not yet available in this build `` | [命令行错误](#claude-import-is-not-yet-available-in-this-build) |
+| `Could not read Claude Code config` | [命令行错误](#could-not-read-claude-code-config) |
| `Could not import : ` | [命令行错误](#could-not-import-a-server-from-claude-desktop) |
+| `Cannot add MCP server to scope: managed` | [命令行错误](#cannot-add-mcp-server-to-the-managed-scope) |
+| `is Anthropic-hosted and doesn't support local OAuth` | [命令行错误](#anthropic-hosted-and-doesnt-support-local-oauth) |
+| `Can't read .mcp.json: it isn't a regular file or is larger than 2097152 bytes` | [命令行错误](#cant-read-mcp-json) |
+| `Server rejected the Authorization header minted by the configured headersHelper` | [命令行错误](#server-rejected-the-authorization-header-minted-by-the-configured-headershelper) |
| `Error: MCP tool (passed via --permission-prompt-tool) not found` | [命令行错误](#mcp-permission-prompt-tool-not-found) |
-| `Marketplace "" is registered from an untrusted source` | [插件错误](#marketplace-is-registered-from-an-untrusted-source) |
-| `references ${user_config.*} in a shell-form command` | [插件错误](#plugin-command-references-user-config) |
-| `Monitor "" from plugin references ${user_config.*} in its command` | [插件错误](#plugin-command-references-user-config) |
-| `headersHelper for MCP server '' references ${user_config.*}` | [插件错误](#plugin-command-references-user-config) |
+| `OAuth callback port is already in use — another process may be holding it` | [命令行错误](#oauth-callback-port-is-already-in-use) |
+| `No available ports for OAuth redirect` | [命令行错误](#no-available-ports-for-oauth-redirect) |
+| `Shell command failed for pattern "..."`, from `/security-review` or any skill that injects dynamic context | [命令行错误](#security-review-fails-without-origin-head) |
+| `Shell command permission check failed for pattern "..."`, from a skill that injects dynamic context | [命令行错误](#security-review-fails-without-origin-head) |
+| ``Skill requires bash (`shell: bash` in frontmatter) but Git Bash was not found`` | [命令行错误](#security-review-fails-without-origin-head) |
+| `Input must be provided either through stdin or as a prompt argument when using --print` | [命令行错误](#input-must-be-provided-when-using-print) |
+| `Error: Input contained only whitespace` | [命令行错误](#input-contained-only-whitespace) |
+| `Blank prompt — the message was only whitespace, so nothing was sent to the model.` | [命令行错误](#input-contained-only-whitespace) |
+| `Error: stream-json input carried over 256M characters with no newline` | [命令行错误](#stream-json-input-carried-over-256m-characters-with-no-newline) |
+| `Unknown command: /`, with or without a `Did you mean` suggestion | [命令行错误](#unknown-command) |
+| `Diff is too large for ultrareview` / `PR # is too large for ultrareview` | [命令行错误](#diff-is-too-large-for-ultrareview) |
+| `Could not find merge-base with ` | [命令行错误](#could-not-find-merge-base-with-the-base-branch) |
+| `Your checkout has no branches (detached HEAD only)` | [命令行错误](#your-checkout-has-no-branches) |
+| `Ultrareview clones / in the cloud with the GitHub account connected to your Claude account, and none is connected` | [命令行错误](#no-github-account-is-connected-to-your-claude-account) |
+| `Your connected GitHub account can't see /` | [命令行错误](#your-connected-github-account-cant-see-the-repository) |
+| `The GitHub App preflight failed transiently (network or service hiccup) — retry in a moment to start from GitHub instead` | [命令行错误](#the-github-app-preflight-failed-transiently) |
+| `GitHub isn't connected to your Claude account, so this repository can't be cloned in the cloud` | [命令行错误](#github-isnt-connected-to-your-claude-account) |
+| `Single sign-on authorization needed` | [命令行错误](#single-sign-on-authorization-needed) |
+| `Failed to resume the conversation` | [命令行错误](#failed-to-resume-the-conversation) |
+| `No conversation found with session ID: ` | [命令行错误](#no-conversation-found-with-the-session-id) |
+| `Cannot switch renderers in this session` | [命令行错误](#cannot-switch-renderers-in-this-session) |
+| `Cannot switch renderers while work is running in the background` | [命令行错误](#cannot-switch-renderers-in-this-session) |
+| `Couldn't open Claude Desktop` | [命令行错误](#couldnt-open-claude-desktop) |
+| `Failed to open Claude Desktop. Please try opening it manually.` | [命令行错误](#couldnt-open-claude-desktop) |
+| `Couldn't read your Zed keymap` / `Couldn't back up your Zed keymap` / `Couldn't update your Zed keymap` | [命令行错误](#terminal-setup-left-your-zed-keymap-unchanged) |
+| `Your Zed keymap isn't a readable list of keybindings` | [命令行错误](#terminal-setup-left-your-zed-keymap-unchanged) |
+| `Skill usage reports are not available on this connection.` | [命令行错误](#skill-usage-reports-are-not-available-on-this-connection) |
+| `Custom output styles can't be selected over Remote Control or from a relayed message` | [命令行错误](#custom-output-styles-cant-be-selected-over-remote-control) |
+| `Output styles are saved to local settings (.claude/settings.local.json), which this session doesn't load` | [命令行错误](#output-styles-are-saved-to-local-settings-which-this-session-doesnt-load) |
+| `` `plugin eval` is currently in early access `` / `` `plugin eval` is currently unavailable `` | [Plugin 错误](#plugin-eval-is-currently-in-early-access) |
+| `Marketplace "" is registered from an untrusted source` | [Plugin 错误](#marketplace-is-registered-from-an-untrusted-source) |
+| `Marketplace "" is already added from a different source` | [Plugin 错误](#marketplace-is-already-added-from-a-different-source) |
+| `"" is another spelling of "", a reserved marketplace name` | [Plugin 错误](#marketplace-name-is-another-spelling-of-a-reserved-name) |
+| `references ${user_config.*} in a shell-form command` | [Plugin 错误](#plugin-command-references-user-config) |
+| `Monitor "" from plugin references ${user_config.*} in its command` | [Plugin 错误](#plugin-command-references-user-config) |
+| `headersHelper for MCP server '' references ${user_config.*}` | [Plugin 错误](#plugin-command-references-user-config) |
+| `Plugin archive integrity check failed` | [Plugin 错误](#plugin-archive-integrity-check-failed) |
+| `path escapes plugin directory` | [Plugin 错误](#path-escapes-plugin-directory) |
+| `path could not be checked` | [Plugin 错误](#path-could-not-be-checked) |
+| `its marketplace entry path does not stay inside the marketplace directory` | [Plugin 错误](#marketplace-entry-path-does-not-stay-inside-the-marketplace-directory) |
+| `Plugin source path refused` | [Plugin 错误](#marketplace-entry-path-does-not-stay-inside-the-marketplace-directory) |
+| `Failed to load marketplace configuration` | [Plugin 错误](#failed-to-load-marketplace-configuration) |
+| `Marketplace configuration file is corrupted` | [Plugin 错误](#failed-to-load-marketplace-configuration) |
+| `Plugin "@synced" is required by your organization and can't be disabled here` | [Plugin 错误](#plugin-is-required-by-your-organization) |
| `would be spawned with zero tools — refusing` | [工具错误](#agent-would-be-spawned-with-zero-tools) |
| `File is covered by a Read deny rule in your permission settings` | [工具错误](#file-is-covered-by-a-read-deny-rule) |
+| `subagent_type is required: the general-purpose agent is not available in this session` | [工具错误](#subagent-type-is-required) |
+| `Error: this write left the memory index at MEMORY.md at ..., over its ... read limit` | [工具错误](#memory-index-is-over-its-read-limit) |
+| `pkill: refusing to run` | [工具错误](#pkill-pattern-matches-the-claude-code-process) |
+| `Failed to write to 's inbox — nothing was sent` | [工具错误](#failed-to-write-to-a-teammate-inbox) |
+| `Failed to write the plan approval request to the lead's inbox — plan not submitted` | [工具错误](#failed-to-write-to-a-teammate-inbox) |
+| `Its agent definition was not restored: the folder its definition file came from is not trusted` | [工具错误](#teammate-agent-definition-not-restored) |
+| `Message too large for cross-session delivery` | [工具错误](#message-too-large-for-cross-session-delivery) |
+| `Too many messages to this session just now` | [工具错误](#too-many-messages-to-this-session-just-now) |
+| `Refusing to send: reply target is a symlink` / `Refusing to send: cannot vet reply target` | [工具错误](#refusing-to-send-a-cross-session-message) |
+| `Refusing to send: connected endpoint is not the expected process` / `Refusing to send: connected endpoint identity could not be read` | [工具错误](#refusing-to-send-a-cross-session-message) |
+| `Refusing to send: connected endpoint is not owned by this user` / `Refusing to send: connected endpoint owner could not be read` | [工具错误](#refusing-to-send-a-cross-session-message) |
+| `Refusing to send: connected endpoint is a different process with the expected pid` | [工具错误](#refusing-to-send-a-cross-session-message) |
+| `Refusing to read : its symlink resolution changed after permission was checked ()` / `Refusing to search : its symlink resolution changed after permission was checked` | [工具错误](#refusing-after-a-symlink-changed) |
+| `Refusing to write : its parent-directory symlink resolution changed after permission was checked` / `Refusing to write : it is a symbolic link. Write to the link's target path instead` | [工具错误](#refusing-after-a-symlink-changed) |
+| `Refusing to write through symlink: ` / `Refusing to write into symlinked directory: ` | [工具错误](#refusing-after-a-symlink-changed) |
+| `Refusing to search : a path one of its Read deny rules is written through changed while the search was being prepared` / `Refusing to search : it could not be opened` | [工具错误](#refusing-after-a-symlink-changed) |
+| `its permission check expired before it ran (too many concurrent file operations)` / `ripgrep was found only by name on PATH` | [工具错误](#refusing-after-a-symlink-changed) |
+| `task output swap refused (tasks dir moved or linked)` | [工具错误](#task-output-swap-refused) |
+| `Command killed: its output file was replaced or could no longer be verified` | [工具错误](#task-output-swap-refused) |
+| `the source file is not valid UTF-8 text` / `the source file is not valid UTF-16 text` | [工具错误](#the-source-file-is-not-valid-utf-8-text) |
+| `the source file has the replacement character U+FFFD` | [工具错误](#the-source-file-is-not-valid-utf-8-text) |
+| `Reading a local file from outside this session's connected folders, or through a link, needs the approval card` | [工具错误](#reading-a-local-file-from-outside-the-connected-folders) |
+| `cannot read file_path (...) — the file could not be examined, and no one can answer the approval card` | [工具错误](#reading-a-local-file-from-outside-the-connected-folders) |
+| `WebFetch cannot fetch localhost or other hostnames without a dot` | [工具错误](#webfetch-cannot-fetch-localhost) |
+| `Can't open MCP settings while no terminal is attached to this background session` | [后台会话错误](#commands-refused-in-a-background-session) |
| `Can't open MCP settings in a background session` | [后台会话错误](#commands-refused-in-a-background-session) |
+| `blocked because the path is spelled in a form that cannot be safely resolved` | [后台会话错误](#write-or-command-blocked-because-the-path-cannot-be-safely-resolved) |
+| `blocked because the path is network-shaped` | [后台会话错误](#write-or-command-blocked-because-the-path-names-a-network-location) |
+| `is isolated in the worktree , but this command . Refusing to run it` | [后台会话错误](#command-blocked-by-the-worktree-isolation-checks) |
+| `too complex to verify that it stays inside the worktree` | [后台会话错误](#command-blocked-by-the-worktree-isolation-checks) |
+| `This session has no saved transcript` | [后台会话错误](#this-session-has-no-saved-transcript) |
+| `Can't open — this session is running in another terminal` | [后台会话错误](#this-session-is-running-in-another-terminal) |
+| `This conversation is already open in another running Claude session` | [后台会话错误](#this-session-is-running-in-another-terminal) |
+| `This session's saved conversation is no longer on disk` | [后台会话错误](#this-sessions-saved-conversation-is-no-longer-on-disk) |
+| `kept — its worktree is still at ` | [后台会话错误](#worktree-has-commits-that-are-not-pushed-anywhere) |
+| `kept — unpushed commits on ` | [后台会话错误](#worktree-has-commits-that-are-not-pushed-anywhere) |
+| `kept — worktree has commits that are not pushed anywhere` | [后台会话错误](#worktree-has-commits-that-are-not-pushed-anywhere) |
+| `terminal host process died — press Enter to restart` / `This session's terminal host process died` | [后台会话错误](#terminal-host-process-died) |
+| `Session isn't responding` / `Press enter again to restart this session — it isn't responding` | [后台会话错误](#session-isnt-responding) |
+| `Session was stopped while the respawn was in flight` | [后台会话错误](#session-was-stopped-while-the-respawn-was-in-flight) |
+| `This session was running agent '', which is no longer available` | [后台会话错误](#session-agent-no-longer-available) |
| `CLAUDE_CODE_PROCESS_WRAPPER: launcher ...` | [后台会话错误](#claude_code_process_wrapper-launcher-errors) |
+| `EUNKNOWN: unknown error, uv_spawn` | [后台会话错误](#eunknown-when-starting-a-background-session) |
+| `EACCES: permission denied, posix_spawn` | [后台会话错误](#eacces-when-starting-a-background-session) |
+| `exited before it became reachable` | [后台会话错误](#background-service-exited-before-it-became-reachable) |
+| `Couldn't start a background session (working directory no longer exists or is not accessible: ...)` | [后台会话错误](#working-directory-no-longer-exists-when-starting-a-background-session) |
+| `Claude Code is being updated by npm on this machine (still not runnable after 2 min, ...)` | [后台会话错误](#eacces-when-starting-a-background-session) |
+| `Claude Code process exited with code N` | [包装器和 IDE 错误](#claude-code-process-exited-with-code-n) |
+| `The connection to Claude Code ended before this message completed` | [包装器和 IDE 错误](#the-connection-to-claude-code-ended-before-this-message-completed) |
+| `Could not locate the Claude CLI on PATH` | [包装器和 IDE 错误](#could-not-locate-the-claude-cli-on-path) |
+| `Restored the code, but skipped N files` | [Rewind 警告和错误](#restored-the-code-but-skipped-files) |
+| `No files were restored: N files failed (backup missing, or the file could not be updated)` | [Rewind 警告和错误](#no-files-were-restored) |
+| `Transcript writes are failing (...)` | [会话保存警告](#transcript-writes-are-failing) |
+| `Transcript saving is off — CLAUDE_CODE_SKIP_PROMPT_HISTORY is set` | [会话保存警告](#transcript-saving-is-off-skip-prompt-history) |
+| `Transcript saving is off — inherited CLAUDE_CODE_CHILD_SESSION marker` | [会话保存警告](#transcript-saving-is-off-child-session-marker) |
+| `Claude Code's fullscreen renderer didn't finish starting last time on this machine` / `Claude Code's fullscreen renderer has repeatedly failed to start on this machine` | [配置警告](#fullscreen-failed-start-notice) |
+| `Claude Code exited after an unrecoverable interface error (...)` | [配置警告](#exited-after-an-unrecoverable-interface-error) |
+| `Agent descriptions are over the 15.0k-token limit` | [配置警告](#agent-descriptions-are-over-the-15000-token-limit) |
| `Ignoring N permissions.allow entries from ... this workspace has not been trusted` | [配置警告](#workspace-has-not-been-trusted) |
-| 响应质量似乎低于平常 | [响应质量](#responses-seem-lower-quality-than-usual) |
+| `is a network path, which cannot be added as a working directory` | [配置警告](#working-directory-is-a-network-path) |
+| `Remote managed settings failed to load ()` | [配置警告](#remote-managed-settings-failed-to-load) |
+| `Managed settings were not approved; exiting without applying them.` | [配置警告](#managed-settings-were-not-approved) |
+| `MCP server is blocked by enterprise managed policy` | [配置警告](#mcp-server-is-blocked-by-enterprise-managed-policy) |
+| `Managed settings document could not be parsed as a JSON object; none of its settings are in effect. Fix or remove it.` | [配置警告](#managed-settings-document-could-not-be-parsed) |
+| `Managed settings drop-in directory could not be read` | [配置警告](#managed-settings-document-could-not-be-parsed) |
+| `otelHeadersHelper failed; telemetry is not being exported. See /status: ...` | [配置警告](#otelheadershelper-failed) |
+| `"crossSessionInbound" must be one of "accept", "hold", "refuse"` | [配置警告](#crosssessioninbound-must-be-one-of-accept-hold-refuse) |
+| `headersHelper not run — this workspace has no persisted trust` | [配置警告](#headershelper-not-run) |
+| `Invalid permission rule "..." was skipped: Malformed Tool(content) rule` | [配置警告](#malformed-tool-content-rule) |
+| `... is not matched by file permission checks` | [配置警告](#is-not-matched-by-file-permission-checks) |
+| `... has a wildcard before the rest of the command` | [配置警告](#has-a-wildcard-before-the-rest-of-the-command) |
+| `CLAUDE_CODE_DISABLE_1M_CONTEXT is set, but the 200K limit isn't enforced` | [配置警告](#the-200k-limit-isnt-enforced) |
+| `[claude-code:unrecognized_model]` | [配置警告](#unrecognized-model-id-on-a-request) |
+| `Stale sandbox mask files left by a killed session` | [配置警告](#stale-sandbox-mask-files-left-by-a-killed-session) |
+| 响应质量似乎比平时低 | [响应质量](#responses-seem-lower-quality-than-usual) |
自动重试
-Claude Code 在向您显示错误之前会重试瞬时故障。服务器错误、过载响应、请求超时、临时 429 限流和断开的连接都会以指数退避方式重试最多 10 次。从 v2.1.198 开始,这涵盖了在任何可见输出流出之前在响应中途断开的连接:Claude Code 使用相同的退避重新发出请求,轮次继续而不是停止并显示连接错误。从 v2.1.199 开始,不携带您计划配额标头的临时 429 限流在您使用 claude.ai 订阅登录时也会重试;早期版本仅对 API 密钥和企业登录重试它们。
+Claude Code 在显示错误之前,会以指数退避方式重试瞬时故障最多 10 次。它并不总是重试在 Claude 响应过程中途出现的故障。当您看到本页面上的错误之一时,Claude Code 已经对该故障进行了适用的重试;下面的列表说明哪些故障获得完整预算、哪些获得较小预算,以及哪些不获得预算。
-某些故障类别不会重试,因为重试无法成功:
+Claude Code 重试这些故障:
-* 从 v2.1.199 开始,TLS 证书验证失败(例如 TLS 检查代理、缺少 `NODE_EXTRA_CA_CERTS` 包或过期证书)在第一次尝试时失败,因此修复立即出现,而不是在完整重试预算之后。请参阅 [SSL 证书错误](#ssl-certificate-errors)。瞬时 TLS 条件(例如握手超时)仍然会重试。
-* 从 v2.1.199 开始,在 Claude 已经流出可见输出后到达的服务器错误会保留部分响应并附加[不完整响应通知](#the-response-above-may-be-incomplete),而不是重试,因为重新运行请求可能会执行相同的工具两次。早期版本丢弃了部分输出并将轮次报告为错误。
-* [Amazon Bedrock 流式响应具有意外的内容类型](#bedrock-streaming-response-has-an-unexpected-content-type)在第一次尝试时失败,因为网关或代理重写响应会以相同方式重写重试。需要 Claude Code v2.1.208 或更高版本。
+* 在 Claude 响应开始流式传输之前到达的服务器错误、过载响应和请求超时。
+* 连接断开。当连接在请求过程中途断开,且 Claude 尚未完成其响应的任何部分(包括其思考过程)时,Claude Code 会使用相同的退避重新发送请求,转换继续进行,即使某些文本已经开始流式传输。当连接在 Claude 完成思考之后但在开始任何文本或工具调用之前断开时,Claude Code 改为快速连续重新发送请求最多两次,如果连接在该点继续断开,则以 `Connection lost before a response was produced` 结束转换。
+* Claude Code 检测到的连接在您的计算机进入睡眠状态时在请求过程中途被破坏。Claude Code 将其计为上述规则下的断开连接;一旦重试标签命名了具体原因,它会读作 `Connection lost while your computer was asleep`,如果转换在 Claude 完成思考之后但在任何文本或工具调用之前结束,消息会读作 `Your computer went to sleep before a response was produced`。
+* 停滞的响应流,当响应头已到达但 Claude 响应的任何部分都未到达,或当 Claude 完成思考但尚未开始任何文本或工具调用时:Claude Code 中止停滞连接并最多重新发送一次请求,不在上述 10 次尝试预算之外。如果响应在 Claude 完成思考之后但在任何文本或工具调用之前第二次停滞,Claude Code 以 `The response stalled before a response was produced` 结束转换。
+* 流式请求 API 从未用响应头回答,在 [first-byte deadline runs](/docs/zh-CN/network-config#streaming-idle-watchdogs) 的连接上:Claude Code 在截止时间中止它,并在重试预算内每个模型请求最多重新发送一次,然后如果该尝试也未得到回答,则以 [No response from API](#no-response-from-api) 结束转换。在其他连接上,请求等待 `API_TIMEOUT_MS`。当您设置 `CLAUDE_CODE_RETRY_WATCHDOG` 时,一次重试上限不适用。
+* 临时 429 节流,但不是网关的支出限制 `429`,这不是节流;请参阅 [Spend limit reached](#spend-limit-reached)。
+ * 当您使用 claude.ai 订阅登录时,这包括不携带您计划配额头的 429 节流。在 v2.1.199 之前,Claude Code 仅对 API 密钥和企业登录重试这些节流。
+* 因为输入加上 `max_tokens` 超过上下文限制而被拒绝的请求。以相同方式重新发送它会以相同方式失败,所以 Claude Code 使用减少的 `max_tokens` 重试,并在两种情况下停止重试并改为压缩:
+ * 当没有减少可以适应时,例如当对话本身几乎填满上下文窗口时。
+ * 当重试无法进一步缩小 `max_tokens` 时。在 v2.1.218 之前,Claude Code 可以重新发送仍然不适应的减少请求,例如当扩展思考预算超过剩余上下文时,直到重试预算用尽。
+* [Google Cloud 的 Agent Platform](/docs/zh-CN/google-vertex-ai) 上过期或缺失的 Google Cloud 凭证,或在您的机器上加载失败的 AWS 凭证。Claude Code 丢弃其缓存的凭证并重试最多两次,然后报告错误以便您可以立即重新身份验证,如 [Could not load AWS or Google Cloud credentials](#could-not-load-aws-or-google-cloud-credentials) 下所述。在 v2.1.228 之前,Claude Code 通过完整重试预算重试失败的 Google Cloud 凭证,然后显示错误。
+* 来自 Anthropic API 的 `401` 或 `403`,直接或通过 [LLM gateway](/docs/zh-CN/llm-gateway),而 [`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 脚本提供凭证。Claude Code 重新运行脚本并使用其新输出重试,在完整重试预算内。当脚本本身在重新运行时失败时,Claude Code 改为显示 [Your apiKeyHelper script is failing](#your-apikeyhelper-script-is-failing)。
-重试时,微调器在错误标签后显示 `Retrying in Ns · attempt x/y` 倒计时。标签命名了第一次尝试中您可以立即采取行动的特定原因:网络已关闭、TLS 握手失败或您达到了速率限制。对于其他错误,它最初读作 `API error`。从 v2.1.198 开始,它切换到第三次尝试中的特定原因,或当 `CLAUDE_CODE_MAX_RETRIES` 允许少于三次时在最后一次尝试;早期版本仅在最后一次尝试时切换。
+在 v2.1.227 之前,`Connection lost before a response was produced` 读作 `Connection closed while thinking, before producing a response`,`The response stalled before a response was produced` 读作 `Response stalled while thinking, before producing a response`。
-从 v2.1.198 开始,重试期间会抑制通常的微调器提示。一旦错误原因被揭示,如果故障是 529 过载,倒计时下方的行也会命名检查服务状态的位置:Anthropic API 上的 `status.claude.com`,或其他配置上的提供商或网关主机。
+Claude Code 不重试这些故障:
-如果在请求仍然待处理时,响应流上 20 秒内没有数据到达,微调器会显示 `Waiting for API response · will retry in … · check your network`,然后再进行任何重试。请求尚未失败:倒计时运行到 Claude Code 中止停滞连接并重试的点,因此一旦数据恢复或重试成功,横幅就会自动清除。从 v2.1.185 开始,阈值为 20 秒;早期版本在 10 秒后显示横幅,措辞不同。如果它在每次尝试时都重新出现,请将其视为[网络问题](#unable-to-connect-to-api)。
+* TLS 证书验证失败,例如 TLS 检查代理、缺失的 `NODE_EXTRA_CA_CERTS` 包或过期的证书。Claude Code 在第一次尝试时报告错误,以便您可以立即修复证书设置;请参阅 [SSL certificate errors](#ssl-certificate-errors)。Claude Code 仍然重试瞬时 TLS 条件,例如握手超时。在 v2.1.199 之前,Claude Code 通过完整重试预算重试证书失败,然后显示错误。
+* 服务器错误、断开连接或停滞流在 Claude 完成文本块或工具调用之后到达,或在完成思考之后开始一个但在完成响应之前。Claude Code 不重新运行请求,因为这可能会执行相同的工具调用两次。它保留 Claude 完成的内容,运行 Claude 完成的任何工具调用,并从其结果继续转换。对于您在交互式会话和非交互式会话中看到的内容,请阅读 [The response above may be incomplete](#the-response-above-may-be-incomplete)。在 v2.1.199 之前,当服务器错误在流中途到达时,Claude Code 丢弃部分输出并将整个转换报告为错误。
+* 在 Claude 完成响应之后到达的故障:无需重试任何内容,所以 Claude Code 保留完整响应并正常结束转换。
+* [Amazon Bedrock 流式响应具有意外的 content-type](#bedrock-streaming-response-has-an-unexpected-content-type),因为重写响应的网关或代理会以相同方式重写重试。需要 Claude Code v2.1.208 或更高版本。
+* 失败的流式请求的非流式重试获得成功状态但 [body 中没有 Claude API 消息](#api-returned-an-empty-or-malformed-response)。Claude Code 以该错误结束转换。
+* 您的组织的策略检查拒绝的请求,其表现为携带拒绝消息的 `API Error:` 行。您的组织管理员使用 [Inference hooks](https://platform.claude.com/docs/en/manage-claude/inference-hooks)(Claude Enterprise 功能)设置检查,消息以他们配置的说明结尾,或默认告诉您联系他们。Claude Code 不会将拒绝的请求重新发送到相同模型或 [fallback model](/docs/zh-CN/model-config#fallback-model-chains),因为拒绝涉及请求的内容而不是模型。在 v2.1.239 之前,Claude Code 可以重新发送拒绝的请求,不流式传输或在配置的备用模型上,然后向您显示拒绝。
-当您看到本页上的错误之一时,这些重试已经用尽,除非它属于不会重试的类别,例如证书验证失败。您可以使用这些环境变量调整行为:
+
+ Claude Code 重试或等待时您看到的内容
+
+
+重试时,微调器在错误标签后显示 `Retrying in Ns · attempt x/y` 倒计时。标签命名第一次尝试的具体原因,用于您可以立即采取行动的故障:网络已关闭、TLS 握手失败或您达到速率限制。对于其他错误,它最初读作 `API error`。从 v2.1.198 开始,它切换到第三次尝试的具体原因,或当 `CLAUDE_CODE_MAX_RETRIES` 允许少于三次时在最后一次尝试;较早版本仅在最后一次尝试时切换。
+
+从 v2.1.198 开始,通常的微调器提示在重试期间被抑制。一旦错误原因被揭示,如果故障是 529 过载,倒计时下方的行也命名了检查服务状态的位置:Anthropic API 上的 `status.claude.com`,或其他配置上的提供商或网关主机。
+
+如果在请求仍然待处理时响应流上 20 秒内没有数据到达,微调器显示 `Waiting for API response · will retry in … · check your network`,然后任何重试都尚未开始。请求尚未失败:倒计时运行到 Claude Code 中止停滞连接的点。中止后,您看到的内容取决于响应已进行的距离:
+
+* 在 Claude 完成文本块或工具调用之前,或在完成思考之后开始一个,Claude Code 重试请求或以错误结束转换。[Automatic retries](#automatic-retries) 说明它重试哪些停滞以及多少次。
+* 在 Claude 完成文本块或工具调用之后,或在完成思考之后开始一个,但在 Claude 完成响应之前,Claude Code 保留 Claude 完成的内容,从 Claude 完成的任何工具调用继续转换,并显示 [The response above may be incomplete](#the-response-above-may-be-incomplete)。在非交互式会话中,以及对于任何会话中的子代理响应,Claude Code 可能首先提示 Claude 继续响应;该条目说明何时执行以及何时您仍然在那里看到通知。
+* 在 Claude 完成响应之后,Claude Code 正常结束转换。
+
+一旦数据恢复或重试成功,横幅会自动清除。如果它在每次尝试时重新出现,将其视为 [network issue](#unable-to-connect-to-api)。在 v2.1.185 之前,横幅在 10 秒后出现,措辞不同。
+
+当 Claude 咨询 [advisor](/docs/zh-CN/advisor) 时,横幅在 90 秒无数据后出现,而不是 20 秒,因为长时间的顾问审查可以发送超过 20 秒的任何内容。在 v2.1.214 之前,20 秒阈值也适用于顾问调用,所以横幅在顾问审查期间出现,即使没有任何问题。
+
+
+ 调整重试行为
+
+
+您可以使用这些环境变量调整重试行为:
| 变量 | 默认值 | 效果 |
-| :---------------------------------------------- | :----- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
-| [`CLAUDE_CODE_MAX_RETRIES`](/docs/zh-CN/env-vars) | 10 | 重试次数。从 v2.1.186 开始上限为 15;从 v2.1.199 开始 `CLAUDE_CODE_RETRY_WATCHDOG` 提高默认值并移除上限。降低它以在脚本中更快地显示故障。 |
-| [`CLAUDE_CODE_RETRY_WATCHDOG`](/docs/zh-CN/env-vars) | 未设置 | 在 CI 作业等无人值守会话中设置为 `1`,以无限期重试 `429` 和 `529` 容量错误,而不是在 `CLAUDE_CODE_MAX_RETRIES` 次尝试后失败。从 v2.1.199 开始,它也提高了其他瞬时错误(例如服务器错误、超时和断开的连接)的默认重试计数至 300,大约三小时的退避,如果您显式设置该变量,则移除 `CLAUDE_CODE_MAX_RETRIES` 的 15 上限。 |
-| [`API_TIMEOUT_MS`](/docs/zh-CN/env-vars) | 600000 | 每个请求的超时时间(毫秒)。为慢速网络或代理提高它。 |
+| :------------------------------------------------------- | :----- | :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
+| [`CLAUDE_CODE_MAX_RETRIES`](/docs/zh-CN/env-vars) | 10 | 重试尝试次数。从 v2.1.186 开始上限为 15;从 v2.1.199 开始 `CLAUDE_CODE_RETRY_WATCHDOG` 提高默认值并移除上限。降低它以在脚本中更快地显示故障。 |
+| [`CLAUDE_CODE_RETRY_WATCHDOG`](/docs/zh-CN/env-vars) | 未设置 | 在 CI 作业等无人值守会话中设置为 `1`,以无限期重试 `429` 和 `529` 容量错误,而不是在 `CLAUDE_CODE_MAX_RETRIES` 尝试后失败。当标准速度请求获得报告支出限制或耗尽使用额度的 `429` 时,Claude Code 立即失败,即使来自 [gateway spend cap](#spend-limit-reached) 的也是如此,该上限按计划重置。在 v2.1.239 之前,看门狗无限期重试这些。对于快速模式请求,请参阅 [Handle rate limits](/docs/zh-CN/fast-mode#handle-rate-limits)。在 v2.1.199 或更高版本上,它还为其他瞬时错误(例如服务器错误、超时和断开连接)提高默认重试计数至 300,大约三小时的退避,如果您明确设置该变量,则移除 `CLAUDE_CODE_MAX_RETRIES` 的 15 上限。 |
+| [`API_TIMEOUT_MS`](/docs/zh-CN/env-vars) | 600000 | 每个请求的超时(毫秒)。为慢速网络或代理提高它。它还限制 Claude Code 等待响应头的时间,在 [No response from API](#no-response-from-api) 中描述。 |
+| [`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`](/docs/zh-CN/env-vars) | 未设置 | 流式请求的第一个响应字节的截止时间(毫秒)。需要 Claude Code v2.1.242 或更高版本。对于当此未设置时 Claude Code 如何选择截止时间,请参阅 [No response from API](#no-response-from-api)。 |
服务器错误
-这些错误来自推理提供商,而不是您的账户或请求。在 Anthropic API 上,这意味着 Anthropic 基础设施。在 Amazon Bedrock、Google Cloud 的 Agent Platform、Microsoft Foundry 或自定义网关上,这意味着该提供商的基础设施。
+这些错误中的大多数来自推理提供商:Anthropic API 上的 Anthropic 服务,以及 Amazon Bedrock、Google Cloud 的 Agent Platform、Microsoft Foundry 或自定义网关上该提供商端点后面的服务。[Auto mode 无法确定操作的安全性](#auto-mode-cannot-determine-the-safety-of-an-action)和[Agent 因 API 错误而提前终止](#agent-terminated-early-due-to-an-api-error)也涵盖了您这一方的原因,例如无法调用分类器模型的 Amazon Bedrock 账户或达到使用限制的子代理。
- API 错误:500 内部服务器错误
+ API Error: 500 Internal server error
-Claude Code 显示任何 5xx 响应的状态代码和 API 的错误消息。下面的示例显示了 Anthropic API 上的 500 响应:
+Claude Code 显示任何 5xx 响应的状态代码和 API 的错误消息。下面的示例显示 Anthropic API 上的 500 响应:
```text theme={null}
API Error: 500 Internal server error. This is a server-side issue, usually temporary — try again in a moment. If it persists, check https://status.claude.com.
```
-末尾的句子指出了检查服务健康状态的位置,因提供商而异。Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 配置会指出该提供商的服务状态。自定义 `ANTHROPIC_BASE_URL` 会指出网关主机。
+尾部句子指出了检查服务健康状况的位置,因提供商而异。Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 配置会指出该提供商的服务状态。自定义 `ANTHROPIC_BASE_URL` 会指出网关主机。
这表示 API 内部出现了意外故障。它不是由您的提示、设置或账户引起的。
**应该做什么:**
-* 检查 [status.claude.com](https://status.claude.com) 或消息中指定的提供商状态页面,查看是否有活跃的事件
-* 等待一分钟,然后重新发送您的消息。您的原始消息仍在对话中,所以对于较长的提示,您可以输入 `try again` 而不是粘贴整个内容。
-* 如果错误持续存在且没有发布的事件,请运行 `/feedback`,以便 Anthropic 可以使用您的请求详情进行调查。如果 `/feedback` 在您的环境中不可用,请参阅[报告错误](#report-an-error)。
+* 检查 [status.claude.com](https://status.claude.com) 或消息中指出的提供商状态页面,查看是否有活跃事件
+* 等待一分钟,然后再次发送您的消息。您的原始消息仍在对话中,因此对于较长的提示,您可以输入 `try again` 而不是粘贴整个内容。
+* 如果错误持续存在且没有发布事件,请运行 `/feedback` 以便 Anthropic 可以使用您的请求详情进行调查。如果您的环境中 `/feedback` 不可用,请参阅[报告错误](#report-an-error)。
- API 错误:重复的 529 过载错误
+ API Error: Repeated 529 Overloaded errors
API 在所有用户中暂时处于容量限制。Claude Code 在显示此消息之前已经重试了多次:
@@ -155,18 +408,18 @@ API 在所有用户中暂时处于容量限制。Claude Code 在显示此消息
API Error: Repeated 529 Overloaded errors. The API is at capacity — this is usually temporary. Try again in a moment. If it persists, check https://status.claude.com.
```
-末尾的句子因提供商而异,方式与上面的 500 错误相同。
+尾部句子因提供商而异,方式与上面的 500 错误相同。
529 不是您的使用限制,也不会计入您的配额。
**应该做什么:**
-* 检查 [status.claude.com](https://status.claude.com) 或消息中指定的提供商状态页面,查看容量通知
+* 检查 [status.claude.com](https://status.claude.com) 或消息中指出的提供商状态页面,查看容量通知
* 几分钟后重试
-* 运行 `/model` 并切换到不同的模型以继续工作,因为容量是按模型跟踪的。当某个模型处于特别高的负载下时,Claude Code 会提示您这样做,例如 `Opus is experiencing high load, please use /model to switch to Sonnet`。
+* 运行 `/model` 并切换到不同的模型以继续工作,因为容量是按模型跟踪的。当一个模型处于特别高的负载下时,Claude Code 会提示您这样做,例如 `Opus is experiencing high load, please use /model to switch to Sonnet`。
- 请求超时
+ Request timed out
API 在连接截止时间之前没有响应。
@@ -175,56 +428,101 @@ API 在连接截止时间之前没有响应。
Request timed out
```
-这可能发生在高负载期间或模型生成非常大的响应时。默认请求超时为 10 分钟。
+这可能在高负载期间或模型生成非常大的响应时发生。默认请求超时为 10 分钟。
**应该做什么:**
* 重试请求
* 对于长时间运行的任务,将工作分解为较小的提示
-* 如果是由于网络缓慢或代理引起的,请按照[自动重试](#automatic-retries)中的说明提高 `API_TIMEOUT_MS`
+* 如果是缓慢的网络或代理导致,请按照[自动重试](#automatic-retries)中的说明提高 `API_TIMEOUT_MS`
* 如果超时频繁且您的网络状况良好,请参阅下面的[网络和连接错误](#network-and-connection-errors)
+
+ No response from API
+
+
+Claude Code 发送了流式请求,API 在第一个字节的截止时间内没有返回响应头,因此 Claude Code 中止了请求,而不是等待完整的 `API_TIMEOUT_MS` 请求超时(默认为 10 分钟)。Claude Code 最多再发送一次请求,如果[重试预算](#tune-retry-behavior)允许的话。当重试也没有得到回复时,该轮次以此消息结束,该消息显示每次尝试等待了多长时间。当您设置 [`CLAUDE_CODE_RETRY_WATCHDOG`](/docs/zh-CN/env-vars) 时,一次重试的上限不适用,Claude Code 在[调整重试行为](#tune-retry-behavior)中描述的预算下重试。
+
+```text theme={null}
+API Error: No response from API (waited 3m, then 10m on the retry). If a proxy or gateway on your network holds responses until they complete, raise API_TIMEOUT_MS or CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS to wait longer.
+```
+
+Claude Code 分别为第一次尝试的等待响应头和重试的等待设置:
+
+* **第一次尝试**:当您将其设置为 1 或更多时使用 [`CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`](/docs/zh-CN/env-vars),限制在 10 秒到 30 分钟之间。否则 Claude Code 使用[流式空闲监视程序](/docs/zh-CN/network-config#streaming-idle-watchdogs)中列出的字节级监视程序超时,因此改变该超时的变量也会改变此等待。无论哪种方式,Claude Code 为请求体的每 32KB 添加一秒。
+* **重试**:比 `API_TIMEOUT_MS` 少一秒,默认略低于 10 分钟,以便重试可以超过保持响应直到生成完成的代理或网关。在 Amazon Bedrock 上,重试使用与第一次尝试相同的截止时间,消息显示一个持续时间而不是两个。
+
+两个等待都不超过正 `API_TIMEOUT_MS` 少一秒,正 `API_TIMEOUT_MS` 低于 11 秒会关闭截止时间。字节级监视程序仅在响应头到达后才开始,因此在此之后停止发送字节的响应遵循[停滞流规则](#automatic-retries)而不是此截止时间。
+
+**应该做什么:**
+
+* 再次发送您的消息。您的原始消息仍在对话中,因此对于较长的提示,您可以输入 `try again` 而不是粘贴整个内容。
+* 如果重复出现,将其视为[网络或代理问题](#unable-to-connect-to-api)。接受连接但从不转发请求的代理会在每次尝试时产生此错误。
+* 如果您网络上的代理或网关保持响应直到完成,请提高 `API_TIMEOUT_MS` 以便重试等待更长时间。在 Amazon Bedrock 上,也提高 `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS`。
+* 如果第一次尝试持续超时,然后重试成功,请提高 `CLAUDE_STREAM_FIRST_BYTE_TIMEOUT_MS` 以便第一次尝试也等待足够长的时间。
+
+在 v2.1.242 之前,Claude Code 在未回复的流式请求失败之前等待完整的 `API_TIMEOUT_MS` 请求超时(默认为 10 分钟)。在 v2.1.261 之前,重试等待与第一次尝试相同的截止时间,消息没有显示持续时间。
+
- 上面的响应可能不完整
+ The response above may be incomplete
-流式响应在 Claude 已经生成可见输出后失败。重新发送请求可能会运行相同的工具调用两次,因此 Claude Code 保留已经流式传输的内容,并附加此通知,而不是丢弃该轮次。您看到的变体指出了原因:
+流式请求在响应仍在进行中时失败,在 Claude 完成了一个文本块或工具调用之后,或在完成思考后开始了一个。重新发送请求可能会运行相同的工具调用两次,因此 Claude Code 保留 Claude 完成的输出并附加此通知,而不是丢弃该轮次。您看到的变体指出了原因:
```text theme={null}
API Error: Server error mid-response. The response above may be incomplete.
-API Error: Connection closed mid-response. The response above may be incomplete.
-API Error: Response stalled mid-stream. The response above may be incomplete.
+API Error: Connection lost mid-response. The response above may be incomplete.
+API Error: Your computer went to sleep mid-response. The response above may be incomplete.
+API Error: The response stopped arriving. The response above may be incomplete.
```
-* }`Server error mid-response`:流中的过载或 5xx 服务器错误。此变体需要 Claude Code v2.1.199 或更高版本;在此之前,该情况会丢弃部分输出并将整个轮次报告为错误。
-* `Connection closed mid-response`:连接断开。
-* `Response stalled mid-stream`:流停止发送数据。
+* `Server error mid-response`:中流过载或 5xx 服务器错误。此变体需要 Claude Code v2.1.199 或更高版本;在此之前,该情况会丢弃部分输出并将整个轮次报告为错误。
+* `Connection lost mid-response`:连接断开。
+* `Your computer went to sleep mid-response`:Claude Code 检测到您的计算机在响应流式传输时进入睡眠状态。一旦您的计算机唤醒,Claude Code 会将连接视为断开并停止从中读取。
+* `The response stopped arriving`:连接保持打开但停止传递数据,因此流式空闲监视程序中止了它。在 v2.1.222 之前,Claude Code 也可能在通过 `ANTHROPIC_BASE_URL` 或 `ANTHROPIC_AWS_BASE_URL` 到达的[网关](/docs/zh-CN/gateways)连接上报告此故障,同时服务器的保活 ping 仍在到达,因为它只在那里计算已解析的响应事件;升级会停止这些虚假超时。通过提供商基础 URL(如 `ANTHROPIC_BEDROCK_BASE_URL`)到达的网关不被字节监视程序包装;请参阅[流式空闲监视程序](/docs/zh-CN/network-config#streaming-idle-watchdogs)。
+
+在 v2.1.227 之前,`Connection lost mid-response` 读作 `Connection closed mid-response`,`The response stopped arriving` 读作 `Response stalled mid-stream`。
+
+在四种情况下,Claude Code 处理故障而不立即显示此通知:
+
+* 在响应的早期,Claude Code 要么重试故障,要么以不同的错误结束轮次。请参阅[自动重试](#automatic-retries)。
+* 当这些故障之一在 Claude 完成响应后到达时,Claude Code 保留完整响应并正常结束轮次,没有此通知。在 v2.1.222 之前,当连接在响应完成后断开或停滞时,Claude Code 显示此通知,并将轮次报告为错误,即使响应是完整的。
+* 在[非交互式会话](/docs/zh-CN/headless)中,例如 `-p` 运行、[Agent SDK](/docs/zh-CN/agent-sdk/overview) 运行或[云会话](/docs/zh-CN/claude-code-on-the-web),当截断响应在主对话中且包含文本但没有工具调用时,您不必自己发送 `continue`:Claude Code 保留部分输出并提示 Claude 从停止的地方继续,最多连续三次。您只有在 Claude Code 用完这些继续后才会看到此通知。在 v2.1.246 之前,Claude Code 在第一次截断时以此通知结束非交互式轮次。
+* 在[子代理](/docs/zh-CN/sub-agents#api-errors-in-subagents)中,无论会话是否交互式:当其截断响应包含文本但没有工具调用时,Claude Code 提示子代理继续。通知仅在这些继续用完后才成为子代理的最后一条消息。在 v2.1.257 之前,子代理在第一次截断时显示此通知。
**应该做什么:**
-* 阅读流式传输的响应。没有任何内容丢失,但最后的句子或工具调用可能缺失。
-* 回复 `continue` 让 Claude 从停止的地方继续
-* 如果在任何可见输出之前出现相同的错误,Claude Code 会重试请求而不是完成它。请参阅[自动重试](#automatic-retries)。
+* 在交互式会话中,阅读屏幕上剩余的响应:Claude Code 保留 Claude 在错误前完成的每个块,但当轮次结束时丢弃中断的最后块,因此最后的句子或工具调用可能会丢失。回复 `continue` 以让 Claude 从其最后完成的块继续。
+* 在[非交互式模式](/docs/zh-CN/headless)(`-p`)中:
+ * 使用默认文本输出,Claude Code 打印它仍然从轮次早期保留的最后完成的文本块,然后是此消息。当它不保留任何内容时,Claude Code 仅打印此消息,例如因为 Claude Code 在轮次中间压缩了对话并清除了该文本。在 v2.1.219 之前,Claude Code 仅在 `-p` 文本输出中打印此消息并丢弃它已经生成的响应。
+ * 使用 `--output-format json` 或 `stream-json`,Claude Code 在 `result` 字段中报告此消息。
+ * 一旦连接稳定,要继续该轮次,请恢复会话并按照[继续对话](/docs/zh-CN/headless#continue-conversations)中的说明发送 `continue`。
- 自动模式无法确定操作的安全性
+ Auto mode cannot determine the safety of an action
-[自动模式](/docs/zh-CN/permission-modes#eliminate-prompts-with-auto-mode)用来分类操作的模型无法做出决定,因此自动模式没有自动批准该操作。您看到的消息取决于分类器失败的原因。
+[auto mode](/docs/zh-CN/permission-modes#eliminate-prompts-with-auto-mode) 使用的模型无法对操作进行分类,因此 auto mode 没有自动批准该操作。您看到的消息取决于分类器如何失败。
-在您的工作目录内的读取、搜索和编辑会跳过分类器,因此在所有这些情况下都能继续工作。
+对工作目录内的读取、搜索和编辑会跳过分类器,因此它们在所有这些情况下都继续工作。
-当分类器模型过载时:
+当分类器模型不可用时:
```text theme={null}
- is temporarily unavailable, so auto mode cannot determine the safety of right now. Wait briefly and then try this action again.
+ is temporarily unavailable, so auto mode cannot determine the safety of right now. Wait a moment and then try this action again.
```
+当 Claude Code 可以确定故障类别时,它在 `temporarily unavailable` 后的括号中指出该类别,例如 ` is temporarily unavailable (rate-limited), so auto mode cannot determine the safety of right now`。类别为 `(rate-limited)`、`(overloaded)`、`(server error)`、`(timed out)` 和 `(connection failed)`。速率限制、过载和服务器错误是暂时的,重试有效。如果 `(timed out)` 或 `(connection failed)` 重复出现,请检查您的连接;请参阅[无法连接到 API](#unable-to-connect-to-api)。在 v2.1.229 之前,消息从不指出类别,读作 `Wait briefly and then try this action again`。
+
+当没有类别适用时,消息出现时括号中没有类别;多个故障会产生该形式。在 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock) 上,包括 [Mantle 端点](/docs/zh-CN/amazon-bedrock#use-the-mantle-endpoint),当您的 AWS 账户无法调用消息中指出的模型时,它也会出现,该故障在每次重试时重复,直到您的账户被授予访问该模型的权限。
+
**应该做什么:**
-* 几秒钟后重试;Claude 会看到相同的消息,通常会自动重试
-* 如果重试继续失败,继续执行只读任务,稍后再回到被阻止的操作
-* 这是暂时的,与[自动模式资格](/docs/zh-CN/permission-modes#eliminate-prompts-with-auto-mode)无关;您不需要更改设置
+* 几秒后重试;Claude 看到相同的消息,通常会自动重试。暂时故障与 [auto mode 资格](/docs/zh-CN/permission-modes#eliminate-prompts-with-auto-mode)无关;您不需要更改设置
+* 如果重试持续失败,继续进行只读任务,稍后回到被阻止的操作
+* 在 Amazon Bedrock 上,如果消息在每次重试时返回,请检查您的账户是否可以调用它指出的模型:对于标准 Amazon Bedrock 模型,确认您的 [IAM 策略](/docs/zh-CN/amazon-bedrock#iam-configuration)允许调用它;对于 Mantle 模型 ID,[联系您的 AWS 账户团队](/docs/zh-CN/amazon-bedrock#mantle-endpoint-errors)
+
+当分类器请求失败是因为您的 OAuth 令牌过期或被另一个会话轮换时,Claude Code 刷新令牌并重试请求一次,因此例行令牌过期不会显示为此消息。在 v2.1.216 之前,过期或轮换的令牌会导致每个分类器请求失败,auto mode 会拒绝每个检查的操作,直到令牌被刷新。
当分类器返回无法解析的响应时:
@@ -237,36 +535,81 @@ Auto mode could not evaluate this action and is blocking it for safety — run w
* 重试该操作;这通常在下一次尝试时成功
* 运行 `claude --debug` 并重复该操作以在调试日志中查看底层分类器响应
-当单独的 API 安全检查因早期对话内容而阻止了分类器请求时:
+当单独的 API 安全检查因早期对话内容而阻止分类器请求时:
```text theme={null}
Auto mode could not evaluate this action and is blocking it for safety — a safety check separate from auto mode blocked this request because of earlier conversation content — it isn't about the action itself — run with --debug for details
```
+Claude Code 拒绝该操作,但告诉 Claude 这不是对该操作不安全的判断,并继续进行其他任务而不是重试。这些拒绝不计入 [auto mode 的暂停阈值](/docs/zh-CN/permission-modes#when-auto-mode-falls-back)。在[非交互式](/docs/zh-CN/headless) `-p` 运行中,Claude Code 不会停止运行。Claude 接收的内容取决于它请求操作的位置:
+
+* 对于 `-p` 运行中没有 `--input-format stream-json` 的[后台子代理](/docs/zh-CN/sub-agents#run-subagents-in-foreground-or-background),Claude Code 返回包含 `Agent aborted: auto mode classifier request refused by the safety safeguard in headless mode` 的错误结果
+* 在其他地方,包括交互式会话和 `-p` 运行的主对话,Claude Code 将该拒绝返回给 Claude
+
+在 v2.1.225 之前,Claude Code 将这些拒绝计入暂停阈值,并返回与真正分类器块相同的拒绝消息。
+
**应该做什么:**
-* 这不是关于您的操作的决定。您对话中已有的内容在自动模式将对话发送给分类器时触发了 API 上的安全过滤器
+* 这不是对您的操作的决定。您对话中已有的内容在 auto mode 将对话发送给分类器时触发了 API 上的安全过滤器
* 重试无法帮助;相同的对话内容将再次触发过滤器
-* 切换到不同的[权限模式](/docs/zh-CN/permission-modes),以便在提示时可以批准该操作,或开始一个没有触发内容的新对话
+* 在交互式会话中,切换到不同的[权限模式](/docs/zh-CN/permission-modes),以便您可以在提示时批准该操作
+* 开始一个新对话,不包含触发内容
-当对话大小超过分类器的上下文窗口时:
+当对话增长到超过分类器的上下文窗口时:
```text theme={null}
Auto mode classifier transcript exceeded context window — falling back to manual approval (try /compact to reduce conversation size)
```
-在交互式会话中,自动模式会为该操作回退到正常权限提示,以便您可以手动批准或拒绝它。在[非交互式模式](/docs/zh-CN/headless)中,运行会中止,因为记录只会增长,重试无法成功。
+操作发生的情况取决于 Claude 请求它的位置:
+
+* 在交互式会话中,auto mode 回退到该操作的正常权限提示,以便您可以手动批准或拒绝它
+* 对于[非交互式](/docs/zh-CN/headless) `-p` 运行中没有 `--input-format stream-json` 的[后台子代理](/docs/zh-CN/sub-agents#run-subagents-in-foreground-or-background),Claude Code 返回包含 `Agent aborted: auto mode classifier transcript exceeded context window in headless mode` 的错误结果,运行继续
+* 在 `-p` 运行中的其他地方,没有 [`--permission-prompt-tool`](/docs/zh-CN/cli-reference#cli-flags),没有提示可以回退到,因此操作不运行,运行继续
+
+**应该做什么:**
+
+* 在交互式会话中,在出现的提示中批准或拒绝该操作
+* 在交互式会话中,运行 `/compact` 以减少对话大小,以便后续操作再次适应分类器窗口
+
+
+ The server returned no safety verdict
+
+
+在[服务器端分类器审查](/docs/zh-CN/permission-modes#server-side-classifier-review)下,当服务器对操作没有给出判决时,auto mode 拒绝该操作。当 Claude Code 可以确定一个类别时,拒绝会在括号中指出一个类别,例如 `(timed out)`:
+
+```text theme={null}
+The server-side auto mode classifier gave no verdict (timed out), so auto mode cannot determine the safety of .
+```
+
+消息的其余部分告诉 Claude 一次重试是否可以帮助。在某些这些拒绝之前,Claude Code 会等待,以便 Claude 的下一次尝试不会立即跟随。在交互式会话中等待期间,微调器显示 `Auto mode check unavailable` 和倒计时,按 `Esc` 会中断轮次。
+
+在连续十个响应都没有判决后,auto mode 停止轮次:
+
+```text theme={null}
+Auto mode is unavailable — the server returned no safety verdict for the last 10 responses, so Claude stopped. Send a message to try again, or switch out of auto mode.
+```
+
+停止消息在每种会话中出现在不同的位置:
+
+* 在交互式会话中,消息作为警告出现在记录中,轮次结束
+* 在[非交互式](/docs/zh-CN/headless) `-p` 运行中,运行结束并报告执行错误。使用默认文本输出,消息在 stderr 上打印。
+* 当[子代理](/docs/zh-CN/sub-agents)达到限制时,子代理在完成之前停止,Claude 接收它生成的任何内容,并附带 auto mode 停止它的说明
**应该做什么:**
-* 在出现的提示中批准或拒绝该操作
-* 运行 `/compact` 以减少对话大小,以便后续操作再次适应分类器窗口
+* 发送另一条消息以让 Claude 重试。响应计数重新开始。
+* 如果停止重复且您的请求通过[LLM 网关或代理](/docs/zh-CN/llm-gateway),检查它是否截断流式响应或重写它们。[服务器端分类器审查](/docs/zh-CN/permission-modes#server-side-classifier-review)说明哪种网关行为会导致拒绝,[网关兼容性指南](/docs/zh-CN/llm-gateway-protocol#feature-pass-through)列出了要保持不变的内容。
+* 在启动 Claude Code 之前设置 `CLAUDE_CODE_AUTO_MODE_SERVER=0` 以改用其自己的分类器请求。在 v2.1.281 之前,Claude Code 在直接连接到 Anthropic API 时不读取该变量。
+* 要自己批准操作,请改为[切换出 auto mode](/docs/zh-CN/permission-modes#switch-permission-modes)
+
+在 v2.1.280 之前,Claude Code 立即拒绝来自没有判决的响应的每个操作,从不停止轮次。
- 代理因 API 错误而提前终止
+ Agent terminated early due to an API error
-[子代理](/docs/zh-CN/sub-agents)的 API 请求终止失败,例如因为达到了使用限制或服务器错误的重试用尽,所以子代理在完成其任务之前停止。此消息需要 Claude Code v2.1.199 或更高版本;在此之前,API 错误文本被返回给 Claude,就像它是子代理的结果一样。
+[子代理](/docs/zh-CN/sub-agents)的 API 请求终止失败,例如因为达到了使用限制或服务器错误的重试用尽,因此子代理在完成其任务之前停止。此消息需要 Claude Code v2.1.199 或更高版本;在此之前,API 错误文本被返回给 Claude,就像它是子代理的结果一样。
```text theme={null}
Agent terminated early due to an API error:
@@ -274,66 +617,95 @@ Agent terminated early due to an API error:
**应该做什么:**
-* 将冒号后的错误详情与此页面上的其自己的部分相匹配,例如[使用限制](#usage-limits)或[服务器错误](#server-errors),并按照该部分的步骤操作
+* 将冒号后的错误详情与此页面上的其自己的部分匹配,例如[使用限制](#usage-limits)或[服务器错误](#server-errors),并按照该部分的步骤操作
* 一旦底层错误清除,请要求 Claude 重试任务或[恢复子代理](/docs/zh-CN/sub-agents#resume-subagents)
-当速率限制、过载或服务器错误中断已经生成文本输出的前台子代理时,Claude 会收到该部分输出标记为不完整,而不是此错误。仅输出为工具调用的子代理也会收到此错误;在 v2.1.199 中,该形状返回了空的部分结果。请参阅[子代理中的 API 错误](/docs/zh-CN/sub-agents#api-errors-in-subagents)。
+当速率限制、过载或服务器错误中断已经生成文本输出的前台子代理时,Claude 接收该部分输出标记为不完整,而不是此错误。仅输出为工具调用的子代理也会收到此错误;在 v2.1.199 中,该形状返回了空的部分结果。请参阅[子代理中的 API 错误](/docs/zh-CN/sub-agents#api-errors-in-subagents)。
使用限制
-这些错误表示与您的账户或计划相关的配额已达到。它们不同于[服务器错误](#server-errors),后者会影响所有人。
+本部分中的大多数错误意味着与您的账户或计划相关的配额已达到。其中三个的工作方式不同:[`Server is temporarily limiting requests`](#server-is-temporarily-limiting-requests) 是与您的计划配额无关的服务器端限流,[`Usage credits required for 1M context`](#usage-credits-required-for-1m-context) 是权限检查而非配额耗尽,[`The prompt to confirm went unanswered`](#the-prompt-to-confirm-went-unanswered) 表示使用额度同意提示未被回答而关闭,无论是否达到配额。
- 您已达到会话限制
+ You've hit your session limit
-订阅计划包括滚动使用额度。当额度用尽时,您会看到以下消息之一:
+订阅计划包括滚动使用额度。当额度用完时,您会看到以下消息之一:
```text theme={null}
You've hit your session limit · resets 3:45pm
You've hit your weekly limit · resets Mon 12:00am
You've hit your Opus limit · resets 3:45pm
+You've hit your Sonnet limit · resets 3:45pm
```
-Claude Code 会阻止进一步的请求,直到消息中显示的重置时间。会话和每周限制在所有模型中共享,因此切换模型不会恢复访问权限。Opus 限制仅适用于 Opus 请求,因此使用 `/model` 切换到另一个模型可以继续工作。
+Claude Code 会阻止进一步的请求,直到消息中显示的重置时间。会话和周限制在所有模型中共享,因此切换模型不会恢复访问权限。Opus 和 Sonnet 限制各自仅适用于对该模型系列的请求,因此使用 `/model` 切换到该系列之外的模型可以继续工作。
-使用量同时计入会话和每周额度。单次大量活动突发(例如大型工作流扇出)可能会在会话窗口重置之前耗尽每周额度。
+在使用 claude.ai 订阅登录的交互式会话中,Claude Code 也可以在打开的会话中等待,并在重置后不久继续中断的任务。等待时,会话底部的一行显示 `Usage limit reached · continuing automatically at 3:45pm · esc to cancel`。在空提示处按 `Esc` 可取消等待。有关您看到的内容、如何开始或取消等待以及如何关闭自动继续的信息,请参阅 [Wait for a usage limit to reset](/docs/zh-CN/interactive-mode#wait-for-a-usage-limit-to-reset)。在 v2.1.234 之前,Claude Code 不提供此等待功能。
-**应该怎么做:**
+使用量同时计入会话和周额度。单次大量活动突发(例如大型工作流扇出)可能会在会话窗口重置之前耗尽周额度。
+
+**要做什么:**
-* 等待错误消息中显示的重置时间
-* 对于 Opus 限制,运行 `/model` 并切换到另一个模型以继续工作
-* 运行 `/usage` 查看您的计划限制以及它们何时重置
-* 运行 `/usage-credits` 在 Pro 和 Max 上购买额外使用量,或在 Team 和 Enterprise 上向您的管理员请求。有关如何计费,请参阅[付费计划的使用额度](https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans)。
+* 等待错误中显示的重置时间
+* 在 [Desktop app](/docs/zh-CN/desktop) 的 Code 选项卡中,会话限制卡提供 **Auto-continue when limits reset** 复选框。周限制卡没有。选中后,Desktop app 会在重置后重试中断的轮次,并在卡上显示重试时间。Desktop 复选框和 CLI 中 `/config` 中的 **Continue automatically at usage limit** 设置是分开的,因此需要分别关闭每一个。
+* 对于 Opus 或 Sonnet 限制,运行 `/model` 并切换到该系列之外的模型以继续工作。每个模型都有自己的提示缓存,因此下一个请求会重新读取整个对话,没有缓存命中;请参阅 [Switching models](/docs/zh-CN/prompt-caching#switching-models)
+* 运行 `/usage` 查看您的计划限制以及何时重置
+* 运行 `/usage-credits` 在 Pro 和 Max 上购买额外使用,或在 Team 和 Enterprise 上向您的管理员请求。有关如何计费的信息,请参阅 [usage credits for paid plans](https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans)。
* 要升级您的计划以获得更高的基础限制,请参阅 [claude.com/pricing](https://claude.com/pricing)
-要在达到限制之前监控您的剩余额度,请将 `rate_limits` 字段添加到[自定义状态行](/docs/zh-CN/statusline#rate-limit-usage),或在桌面应用中单击模型选择器旁边的[使用量环](/docs/zh-CN/desktop#check-usage)。
+在窗口用完之前,Claude Code 可以警告您已使用了大部分额度,显示类似 `You've used 85% of your session limit · resets 3:45pm` 的消息。要持续监视您的剩余额度,请将 `rate_limits` 字段添加到 [custom status line](/docs/zh-CN/statusline#rate-limit-usage),或在 Desktop app 中单击模型选择器旁边的 [usage ring](/docs/zh-CN/desktop#check-usage)。
- 1M 上下文需要使用额度
+ Usage credits required for 1M context
-所选模型使用 1M 令牌扩展上下文窗口,而您的计划仅通过使用额度包含它。
+所选模型使用 1M 令牌扩展上下文窗口,您的计划仅通过使用额度包含它。
```text theme={null}
-API Error: Usage credits required for 1M context · run /usage-credits to turn them on, or /model to switch to standard context
+API Error: Usage credits required for 1M context · run /usage-credits to turn them on (they take effect after you restart Claude Code), or /model to switch to standard context
```
-这是一项权利检查,而不是配额耗尽。即使您的会话和每周额度仍有容量,它也会触发。有关哪些计划直接包含 1M 上下文以及哪些需要使用额度,请参阅[扩展上下文](/docs/zh-CN/model-config#extended-context)。
+这是权限检查,而非配额耗尽。即使您的会话和周额度有剩余容量,它也会触发。有关哪些计划直接包含 1M 上下文以及哪些需要使用额度的信息,请参阅 [Extended context](/docs/zh-CN/model-config#extended-context)。Claude Code 在您使用 `/model` 选择模型时运行此检查,仅在直接连接到 Anthropic API 时;如果您将 `ANTHROPIC_BASE_URL` 指向 [LLM gateway](/docs/zh-CN/llm-gateway),`/model` 允许 `[1m]` 选择,网关决定请求是否成功。
-当此错误在对话中期出现,因为上下文增长超过 200K 令牌时,Claude Code 会自动将对话压缩回标准上下文限制以下,并在之后将会话保持在该限制,因此无需采取任何操作。在 v2.1.172 之前的版本上,错误会在每个后续请求(包括 `/compact`)上重复出现;在这些版本上运行 `/clear` 以恢复。以下步骤适用于您明确选择 `[1m]` 模型的情况。
+当此错误在对话中期出现,因为上下文增长超过 200K 令牌时,Claude Code 会自动将对话压缩回标准上下文限制以下,并之后将会话保持在该限制,因此无需采取任何操作。在 v2.1.172 之前的版本中,错误会在每个后续请求(包括 `/compact`)上重复;在这些版本上运行 `/clear` 以恢复。以下步骤适用于您明确选择 `[1m]` 模型的情况。
-**应该怎么做:**
+**要做什么:**
* 运行 `/model` 并选择不带 `[1m]` 后缀的变体以回退到标准上下文窗口
-* 运行 `/usage-credits` 在 Pro 和 Max 上为 1M 变体启用按量计费,或在 Team 和 Enterprise 上向您的管理员请求
-* 如果 `/model` 后错误仍然存在,1M 模型 ID 可能在其他地方设置。有关要按优先级顺序检查的配置位置,请参阅[所选模型存在问题](#theres-an-issue-with-the-selected-model)。
+* 在消息命名 `/usage-credits` 的地方,运行它以在 Pro 和 Max 上为 1M 变体启用按量计费,或在 Team 和 Enterprise 上向您的管理员请求使用额度。启用使用额度后,重启 Claude Code 或启动新会话,按消息所说的进行。在此之前,会话保持在标准上下文限制。
+* 如果在 `/model` 后错误仍然存在,1M 模型 ID 可能在其他地方设置。有关要按优先级检查的配置位置,请参阅 [Setting your model](/docs/zh-CN/model-config#setting-your-model)。
* 要从模型选择器中完全删除 1M 变体,请设置 [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](/docs/zh-CN/env-vars)
+在 v2.1.268 之前,消息以 `run /usage-credits to turn them on, or /model to switch to standard context` 结尾,没有提及重启。
+
+
+ The prompt to confirm went unanswered
+
+
+如果您的账户需要 [Fable usage-credits consent](/docs/zh-CN/model-config#fable-and-usage-credits),Claude Code 会在 Fable 请求计费使用额度之前要求您确认。当在可能没有人在其终端的会话中没有人回答该同意提示时,Claude Code 会关闭提示并以以下消息之一结束轮次:
+
+```text theme={null}
+Fable limit reached · continuing on Fable 5.1 uses usage credits, and the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
+Fable 5.1 now uses usage credits · the prompt to confirm went unanswered — nothing was sent · answer it where this session is running, or /model to change
+```
+
+消息命名会话的 Fable 模型,因此在 Fable 5 上它们读作 `continuing on Fable 5` 和 `Fable 5 now uses usage credits`。在 v2.1.257 之前,第一条消息以 `Fable 5 limit reached` 开头。
+
+这发生在 [Remote Control](/docs/zh-CN/remote-control) 会话、[background sessions](/docs/zh-CN/agent-view) 和 [agent team](/docs/zh-CN/agent-teams) 队友会话中。Claude Code 仅在会话自己的交互式视图中显示同意提示:运行它的终端,或对于后台会话,一旦您附加,[agents view](/docs/zh-CN/agent-view)。Remote Control 客户端无法显示它。Claude Code 在 [`dialogExpiry`](/docs/zh-CN/settings-reference#dialogexpiry) 截止时间关闭提示,默认为五分钟,或一旦新提示到达而没有人在该终端输入时立即关闭,例如从 Remote Control 客户端发送的提示。在会话运行的终端输入会取消截止时间,Claude Code 等待您的答案。在附加的后台会话视图中,输入不会取消截止时间,新提示仍会关闭同意提示,因此在任何一个发生之前回答。Claude Code 不发送任何内容并保持您的模型,因此当您发送下一个提示时,Claude Code 会再次显示同意提示。
+
+**要做什么:**
+
+* 在会话运行的终端,发送另一个提示并在它重新出现时回答同意提示。对于后台会话,首先从 [agents view](/docs/zh-CN/agent-view) 附加到它。从 Remote Control 客户端重新发送会再次显示此消息,因为客户端无法显示提示。
+* 运行 `/model` 切换到不计费使用额度的模型
+* 要给自己更多时间到达该终端,请将 [`dialogExpiry`](/docs/zh-CN/settings-reference#dialogexpiry) 设置为更长的值或 `"never"`
+
+在 v2.1.236 之前,此消息没有出现:当 Remote Control 客户端连接时,Claude Code 等待 60 秒以获得答案,然后在您的默认模型上继续轮次。
+
- 服务器暂时限制请求
+ Server is temporarily limiting requests
API 应用了与您的计划配额无关的短期限流。
@@ -342,47 +714,114 @@ API 应用了与您的计划配额无关的短期限流。
API Error: Server is temporarily limiting requests (not your usage limit)
```
-Claude Code 通过真实限制响应所携带的统一配额标头的缺失来区分这些与您的计划限制。从 v2.1.199 开始,无论您如何进行身份验证,这都会[自动重试](#automatic-retries)并进行退避,然后才会显示。在早期版本上,使用 claude.ai 订阅登录的会话在第一次出现时失败;只有 API 密钥和 Enterprise 登录会重试。
+Claude Code 通过真实限制响应所携带的统一配额标头的缺失来区分这些。从 v2.1.199 开始,这是 [retried automatically](#automatic-retries) 带有退避,无论您如何进行身份验证。在早期版本中,使用 claude.ai 订阅登录的会话在第一次出现时失败轮次;只有 API 密钥和 Enterprise 登录重试了它。
-**应该怎么做:**
+**要做什么:**
* 稍等片刻后重试
* 如果问题仍然存在,请检查 [status.claude.com](https://status.claude.com)
- 请求被拒绝 (429)
+ Request rejected (429)
-您已达到为 API 密钥、Amazon Bedrock 项目或 Google Cloud 项目配置的速率限制。
+您已达到为您的 API 密钥、Amazon Bedrock 项目或 Google Cloud 项目配置的速率限制。
```text theme={null}
API Error: Request rejected (429) · this may be a temporary capacity issue. If it persists, check https://status.claude.com.
```
-尾部句子指出检查服务健康状况的位置,因提供商而异。Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 配置会指出该提供商的服务状态,而不是 Anthropic 状态页面。自定义 `ANTHROPIC_BASE_URL` 会指出网关主机。
+尾部句子命名检查服务健康的位置,并因提供商而异。Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 配置命名该提供商的服务状态,而不是 Anthropic 状态页面。自定义 `ANTHROPIC_BASE_URL` 命名网关主机。
-**应该怎么做:**
+**要做什么:**
+
+* 运行 `/status` 并确认活跃凭证是您期望的。环境中的流浪 `ANTHROPIC_API_KEY` 可能会通过低层密钥而不是您的订阅路由请求。
+* 检查您的提供商控制台以了解活跃限制,如果需要请求更高的层级
+* 对于 Anthropic API 密钥,请参阅 [rate limits reference](https://platform.claude.com/docs/en/api/rate-limits) 了解层级如何工作以及如何设置每个工作区的上限
+* 降低并发:降低 [`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`](/docs/zh-CN/env-vars),避免运行许多并行子代理,或使用 `/model` 为高容量脚本运行切换到更小的模型
+
+
+ You've hit your monthly spend limit
+
+
+您的计划包含的使用量无法覆盖此请求,而本应为其付款的 [usage credits](https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans) 已达到支出限制。这发生在您的计划的使用窗口之一用完时,或当请求是仅由使用额度支付的请求时,例如对 [bills to usage credits](/docs/zh-CN/model-config#fable-and-usage-credits) 的模型的请求。消息命名其限制阻止了您。`·` 后的文本说明如何增加该限制,并因您的计划和您是否管理计费而异:
+
+```text theme={null}
+You've hit your monthly spend limit · raise it at claude.ai/settings/usage
+You've hit your individual spend limit · ask your admin for a higher limit
+You've hit your org's monthly spend limit · visit claude.ai/admin-settings/usage to raise it
+You've hit your team's shared budget · ask your admin to raise it at claude.ai/admin-settings/usage
+You've hit your channel's monthly spend limit · an org owner or channel manager can raise it in the channel's Claude settings
+```
+
+`team's shared budget` 是管理员分配给您所属的组的汇总预算;消息不命名该组。`channel's monthly spend limit` 是会话运行的一个 Slack 频道的预算,因此您的组织可能在其外部仍有预算。
+
+当您的计划的窗口之一用完时,消息也会说该窗口何时重置,例如 `· your session limit resets 3:45pm`,访问权限会在那时返回,无需任何人提高限制。在使用基于使用量的计费的组织中,消息说 `usage limit` 代替 `spend limit`,如 `You've hit your individual usage limit`。
+
+在 v2.1.239 之前,消息没有命名计划窗口的重置时间。在 v2.1.268 之前,组的汇总预算产生 `individual spend limit` 消息而不是 `team's shared budget`。
+
+如果您通过 Claude apps gateway 连接并看到小写 `spend limit reached`,那是您的网关操作员的上限;请参阅 [Spend limit reached](#spend-limit-reached)。
+
+**要做什么:**
+
+* 在 Pro 和 Max 上,在 claude.ai 的 [**Settings > Usage**](https://claude.ai/settings/usage) 中增加您的月度支出限制,或运行 `/usage-credits`
+* 在 Team 和 Enterprise 上,如果您管理计费,在 [**Admin settings > Usage**](https://claude.ai/admin-settings/usage) 中增加限制,或要求管理员这样做。`/usage-credits` 为您向您的管理员发送该请求
+* 对于频道的限制,要求组织所有者或频道的管理员在 claude.ai 上提高它。请参阅 Claude Tag 文档中的 [Per-channel limits](https://claude.com/docs/claude-tag/admins/set-spend-limit#per-channel-limits)
+* 如果消息命名您的计划窗口的重置时间,您可以改为等待它
+* 运行 `/usage` 查看您的计划窗口以及每个何时重置
-* 运行 `/status` 并确认活跃凭证是您期望的凭证。环境中的杂散 `ANTHROPIC_API_KEY` 可能会通过低级密钥而不是您的订阅来路由请求。
-* 检查您的提供商控制台以了解活跃限制,如果需要,请请求更高的层级
-* 对于 Anthropic API 密钥,请参阅[速率限制参考](https://platform.claude.com/docs/en/api/rate-limits)了解层级如何工作以及如何设置每个工作区的上限
-* 降低并发:降低 [`CLAUDE_CODE_MAX_TOOL_USE_CONCURRENCY`](/docs/zh-CN/env-vars),避免运行许多并行子代理,或使用 `/model` 切换到较小的模型以进行大容量脚本运行
+
+ Spend limit reached
+
+
+您通过 [Claude apps gateway](/docs/zh-CN/claude-apps-gateway) 连接,并已超过您的网关操作员设置的 [spend cap](/docs/zh-CN/claude-apps-gateway-spend-limits)。网关阻止您的请求,直到命名的期间重置或操作员提高上限。它将每个被阻止的 `429` 响应标记为 `x-should-retry: false`,因此 Claude Code 显示此消息而不重试。
+
+```text theme={null}
+spend limit reached (daily; resets 2026-08-09 00:00 UTC)
+```
+
+消息命名上限的期间和重置时间,当操作员配置了 `blocked_message` 时,他们的说明跟在它后面。在 v2.1.225 之前,消息仅读作 `spend limit reached`;较旧版本上的网关仍然发送该较短的形式。
+
+**要做什么:**
+
+* 等待消息命名的重置时间,或如果消息包含说明,请遵循操作员的说明
+* 如果您经常达到上限,要求您的网关操作员提高上限
+
+一条相关消息 `spend limit unavailable` 意味着网关无法读取其支出记录,并作为预防措施而不是超过您的上限而阻止了请求。它通常会自行清除;如果它持续存在,请告诉您的网关操作员。
- 信用余额过低
+ Credit balance is too low
-您的 Console 组织已用尽预付信用。
+您的 Console 组织已用完预付额度,或 Claude Code 使用 Console API 密钥发送您的请求,而您打算使用您的订阅。
```text theme={null}
Credit balance is too low
```
-**应该怎么做:**
+**要做什么:**
+
+* 如果您有 Pro、Max、Team 或 Enterprise 计划并看到这个,运行 `/status` 并检查 `API key` 行。环境中已批准的 `ANTHROPIC_API_KEY` 通过该密钥而不是您的订阅路由请求。在当前 shell 中取消设置它并从您的 shell 配置文件中删除它,然后重新启动 `claude`。如果您还没有使用您的订阅登录,运行 `/login`。
+* 在 [platform.claude.com/settings/billing](https://platform.claude.com/settings/billing) 添加额度,并考虑在那里启用自动重新加载,以便余额在达到零之前重新填充
+* 在 Console 中设置每个工作区的支出上限,以防止单个项目耗尽组织余额。请参阅 [Manage costs effectively](/docs/zh-CN/costs)。
+
+
+ Could not update your spend limit
+
+
+服务器拒绝了您在达到支出限制时出现的提示中所做的支出限制更改。
+
+```text theme={null}
+Could not update your spend limit:
+```
+
+当服务器解释拒绝时,消息以该原因结尾,重试相同的值会再次失败。当失败没有服务器提供的原因时,例如连接断开,消息读作 `Could not update your spend limit. Press Enter to retry.` 并且重试可能成功。在 v2.1.216 之前,Claude Code 为每个失败显示通用形式。
-* 在 [platform.claude.com/settings/billing](https://platform.claude.com/settings/billing) 添加信用,并考虑在那里启用自动重新加载,以便在余额达到零之前进行补充
-* 如果您有 Pro、Max、Team 或 Enterprise 计划,请使用 `/login` 切换到订阅身份验证
-* 在 Console 中设置每个工作区的支出上限,以防止单个项目耗尽组织余额。请参阅[有效管理成本](/docs/zh-CN/costs)。
+**要做什么:**
+
+* 如果消息包含原因,选择满足它的限制,例如较低的金额
+* 如果消息仅显示通用形式,重试;失败可能是暂时的
+* 如果更改持续失败,改为从浏览器中的 [claude.ai billing settings](https://support.claude.com/en/articles/12429409-extra-usage-for-paid-claude-plans) 进行
身份验证错误
@@ -402,95 +841,144 @@ Not logged in · Please run /login
**应该做什么:**
-* 运行 `/login` 使用您的 Claude 订阅或 Console 账户进行身份验证
+* 运行 `/login` 以使用您的 Claude 订阅或 Console 账户进行身份验证
* 如果您期望使用环境变量进行身份验证,请确认 `ANTHROPIC_API_KEY` 已在启动 `claude` 的 shell 中设置并导出
-* 对于无法进行交互式登录的 CI 或自动化环境,配置一个 [`apiKeyHelper`](/docs/zh-CN/settings#available-settings) 脚本,在启动时获取密钥
-* 查看 [身份验证优先级](/docs/zh-CN/authentication#authentication-precedence) 了解当存在多个凭证时 Claude Code 使用哪个凭证
+* 对于无法进行交互式登录的 CI 或自动化,配置一个 [`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 脚本,在启动时获取密钥
+* 查看 [身份验证优先级](/docs/zh-CN/authentication#authentication-precedence) 以了解当存在多个凭证时 Claude Code 使用哪个凭证
-如果您被反复提示登录,请参阅 [未登录或令牌过期](/docs/zh-CN/troubleshoot-install#not-logged-in-or-token-expired) 了解系统时钟和 macOS Keychain 修复。
+如果您被重复提示登录,请参阅 [未登录或令牌过期](/docs/zh-CN/troubleshoot-install#not-logged-in-or-token-expired) 了解系统时钟检查和 macOS 凭证存储恢复步骤。
无法解析身份验证方法
-会话到达 API 客户端时没有任何凭证。这出现在 [后台会话](/docs/zh-CN/agent-view)、云会话和 Agent SDK 上下文中,其中交互式登录检查在第一个请求之前不会运行。
+会话到达 API 客户端时没有任何凭证。[后台会话](/docs/zh-CN/agent-view) 和云会话在 worker 启动时没有凭证时显示此消息。交互式、`-p` 和 Agent SDK 运行报告与 [未登录](#not-logged-in) 相同的条件,并仅将此字符串写入其调试日志,因此如果您在那里找到它,请改为遵循该条目。
```text theme={null}
Could not resolve authentication method. Expected one of apiKey, authToken, credentials, config, or profile to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted
```
-在 v2.1.174 之前,分配给空闲预初始化工作进程的后台或云会话即使配置了有效凭证也可能以这种方式失败。升级以恢复。在当前版本中,该错误意味着工作进程没有可用的凭证。
+在当前版本上,该错误意味着 worker 进程没有可用的凭证。在 v2.1.174 之前,分配给空闲预初始化 worker 的后台会话即使配置了有效凭证也可能以这种方式失败。在 v2.1.176 之前,在被声明之前处于空闲状态的云会话也可能失败。升级以恢复。
**应该做什么:**
-* 如果这出现在后台或云会话中且您的凭证已配置,请升级到 v2.1.174 或更高版本
-* 确认 `ANTHROPIC_API_KEY`、`CLAUDE_CODE_OAUTH_TOKEN` 或您的云提供商凭证已在启动工作进程的环境中设置,而不仅仅在您的交互式 shell 中
-* 对于 Agent SDK,请参阅 [身份验证设置](/docs/zh-CN/agent-sdk/overview#get-started)
-* 在同一环境中的交互式会话中运行 `/status` 以确认哪个凭证源可以解析
+* 如果这出现在后台或云会话中且您的凭证已配置,请升级到 v2.1.176 或更高版本
+* 确认 `ANTHROPIC_API_KEY`、`CLAUDE_CODE_OAUTH_TOKEN` 或您的云提供商凭证已在启动 worker 的环境中设置,而不仅仅在您的交互式 shell 中
+* 对于 Agent SDK,请参阅 [快速入门中的身份验证设置](/docs/zh-CN/agent-sdk/quickstart#setup)
+* 在同一环境中的交互式会话中运行 `/status` 以确认哪个凭证源可解析
无效的 API 密钥
-`ANTHROPIC_API_KEY` 环境变量或 `apiKeyHelper` 脚本返回的密钥被 API 拒绝。
+`ANTHROPIC_API_KEY` 环境变量或 `apiKeyHelper` 脚本返回了 API 拒绝的密钥,或 Claude Code 在发送前阻止了来自 `ANTHROPIC_API_KEY` 的密钥。
```text theme={null}
Invalid API key · Fix external API key
```
+当消息在 `Fix external API key` 之后继续,并带有描述如 `Invalid X-Api-Key header value from ANTHROPIC_API_KEY: it contains a line break at character 41 (120 characters on 2 lines).` 时,API 从未看到该密钥。Claude Code 发现了 HTTP 标头无法传输的字符,并在发送前停止了请求。请参阅 [无效的请求标头值](#invalid-request-header-value) 了解如何读取描述并修复该值。
+
**应该做什么:**
* 检查拼写错误并确认密钥未在 [Console](https://platform.claude.com/settings/keys) 中被撤销
-* 在同一 shell 中运行 `env | grep ANTHROPIC`。direnv、dotenv shell 插件和 IDE 终端等工具可以从项目中的 `.env` 文件加载过时的密钥,而无需您显式设置它
-* 取消设置 `ANTHROPIC_API_KEY` 并运行 `/login` 改用订阅身份验证
-* 如果密钥来自 [`apiKeyHelper`](/docs/zh-CN/settings#available-settings) 脚本,直接运行该脚本以确认它在 stdout 上打印有效密钥
-* 运行 `/status` 确认 Claude Code 实际使用的凭证源
+* 在同一 shell 中,运行 `env | grep ANTHROPIC`,或在 PowerShell 中运行 `Get-ChildItem Env:ANTHROPIC*`。direnv、dotenv shell 插件和 IDE 终端等工具可以从项目中的 `.env` 文件加载过时的密钥,而无需您显式设置它
+* 取消设置 `ANTHROPIC_API_KEY` 并运行 `/login` 以改用订阅身份验证
+* 如果密钥来自 [`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 脚本,请直接运行该脚本以确认它在 stdout 上打印有效密钥
+* 运行 `/status` 以确认 Claude Code 实际使用的凭证源
您的 apiKeyHelper 脚本失败
-在 [`apiKeyHelper`](/docs/zh-CN/settings#available-settings) 设置中配置的命令以错误退出、超时或未向 stdout 打印任何内容。没有来自脚本的密钥,请求到达 API 时带有占位符凭证,API 以 `401` 拒绝它。
+Claude Code 运行了您的 [`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 设置中的命令,但没有获得密钥。没有密钥,请求会到达 API,并带有占位符凭证,API 会以 `401` 拒绝它。终端中的 `Authentication` 面板显示发生了以下哪种情况:
+
+* 命令以错误退出或超时
+* 命令未向 stdout 打印任何内容
+* 命令打印了除密钥之外的内容,例如登录横幅或日志行。该面板显示 `returned output that cannot be used as an API key` 并说明了问题所在,而不重复输出。在 v2.1.227 之前,Claude Code 发送命令打印的任何内容,在修剪周围空格后。
```text theme={null}
Your apiKeyHelper script is failing · This usually means you need to re-authenticate with your provider · Run /status to see the script's error output
```
-Claude Code 重新运行脚本并在显示此消息之前最多重试请求两次,因此故障在三次尝试内浮出。在 v2.1.208 之前,Claude Code 花费完整的 [重试预算](#automatic-retries) 使用占位符凭证重新发送请求,然后报告通用的 `401` 身份验证错误而不是脚本故障。
+在 [非交互式模式](/docs/zh-CN/headless) 中,stderr 也带有具体原因,前缀为 `apiKeyHelper failed:`。
+
+Claude Code 重新运行脚本并在显示此消息之前最多重试请求两次,因此故障在三次尝试内出现。在 v2.1.208 之前,Claude Code 花费完整的 [重试预算](#automatic-retries) 使用占位符凭证重新发送请求,然后报告通用 `401` 身份验证错误而不是脚本故障。
+
+运行 `/login` 在这里没有帮助:只要设置存在,helper 的输出 [优先于](/docs/zh-CN/authentication#authentication-precedence) 保存的登录。
+
+**应该做什么:**
+
+* 直接在您的 shell 中运行在 `apiKeyHelper` 中配置的命令以重现故障
+* 如果命令报告会话过期,请使用您的凭证提供商重新身份验证,例如再次登录您的 SSO 或密钥保管库
+* 修复命令,使其仅将密钥打印到 stdout,作为单个可打印 ASCII 令牌,最多 16,384 个字符,并以代码 0 退出。请参阅 [使用 apiKeyHelper 轮换凭证](/docs/zh-CN/llm-gateway-connect#rotate-credentials-with-apikeyhelper) 了解工作设置。
+* 运行 `/status` 查看故障并确认 `apiKeyHelper` 是活跃凭证源。`apiKeyHelper` 行显示 `Failing` 以及最后一次故障的详细信息,例如退出代码和命令的错误输出,并在下一次成功运行后消失。在 v2.1.274 之前,`/status` 仅显示凭证源,而不是故障。
+* 每次命令失败时,其退出代码和错误输出也会出现在终端中的 `Authentication` 面板中。在 v2.1.212 之前,该面板的标题为 `Cloud authentication`。
+
+
+
+Claude Code 即将作为请求标头发送的值包含 HTTP 标头无法传输的字符:换行符、NUL 字节或 `U+00FF` 以上的字符,例如弯引号或零宽空格。Claude Code 在发送任何内容之前停止请求,并命名要修复的变量或设置。通常的原因是从文档或聊天粘贴的凭证,其中包含不可见字符或杂散换行符。
+
+Claude Code 在直接向 Claude API 或通过 [LLM 网关](/docs/zh-CN/llm-gateway) 发送请求时运行此检查。在第三方云提供商(如 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock))上,Claude Code 在发送前不运行它。
+
+```text theme={null}
+Invalid auth token · Fix external auth token
+Invalid ANTHROPIC_CUSTOM_HEADERS · Fix the environment variable
+Invalid request header from the environment · Fix the environment variable
+```
+
+消息的第一部分取决于坏值来自何处:
+
+* `Invalid auth token`:来自 [`ANTHROPIC_AUTH_TOKEN`](/docs/zh-CN/env-vars) 或 [`CLAUDE_CODE_OAUTH_TOKEN`](/docs/zh-CN/env-vars) 的持有者令牌
+* `Invalid ANTHROPIC_CUSTOM_HEADERS`:您在 [`ANTHROPIC_CUSTOM_HEADERS`](/docs/zh-CN/env-vars) 中设置的标头名称或值。描述计算哪个 `Name: Value` 对有问题,例如 `distinct header 2 of 3 parsed from ANTHROPIC_CUSTOM_HEADERS`,而不重复名称或值,因为您选择了两者。
+* `Invalid request header from the environment`:Claude Code 从另一个环境变量(如 `CLAUDE_AGENT_SDK_CLIENT_APP`)复制到请求标头中的值。描述命名要修复的变量。
+
+Claude Code 将此检查捕获的坏 `ANTHROPIC_API_KEY` 报告为 [无效的 API 密钥](#invalid-api-key),具有相同的尾部描述。它将坏的保存 `/login` 凭证报告为 [未登录](#not-logged-in);运行 `/login` 以保存新凭证。[`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 脚本的输出永远不会到达此检查:Claude Code 在脚本运行时验证它,并且输出 HTTP 标头无法传输的失败会导致 [您的 apiKeyHelper 脚本失败](#your-apikeyhelper-script-is-failing)。
+
+在第二个 `·` 之后,消息描述问题,如以下完整示例:
+
+```text theme={null}
+Invalid auth token · Fix external auth token · Invalid Authorization header value from ANTHROPIC_AUTH_TOKEN: it contains a line break at character 41 (120 characters on 2 lines).
+```
-运行 `/login` 在这里无法帮助:只要设置存在,helper 的输出 [优先于](/docs/zh-CN/authentication#authentication-precedence) 保存的登录。
+位置从 1 开始计算字符。描述由固定短语和字符计数构建,因此它永远不包括值本身。它仅在字符是众所周知的不可见或排版字符(如字节顺序标记、零宽空格或弯引号)时命名该字符,并将其他任何内容报告为 `a non-ASCII character`。
**应该做什么:**
-* 在您的 shell 中直接运行在 `apiKeyHelper` 中配置的命令以重现故障
-* 如果命令报告会话已过期,请使用您的凭证提供商重新身份验证,例如再次登录您的 SSO 或密钥保管库
-* 修复命令以便它将密钥打印到 stdout 并以代码 0 退出。有关工作设置,请参阅 [使用 apiKeyHelper 轮换凭证](/docs/zh-CN/llm-gateway-connect#rotate-credentials-with-apikeyhelper)。
-* 运行 `/status` 确认 `apiKeyHelper` 是活跃凭证源。每次命令失败时,其退出代码和错误输出都会出现在终端中的 `Cloud authentication` 面板中。
+* 重新设置消息命名的变量或设置,重新输入报告位置周围的字符,而不是从同一来源再次粘贴
+* 对于 `ANTHROPIC_CUSTOM_HEADERS`,每行保留一个 `Name: Value` 对,并重写消息计数的对
+* 运行 `/status` 以确认哪个凭证源处于活跃状态
此组织已被禁用
-来自已禁用 Console 组织的过时 `ANTHROPIC_API_KEY` 正在覆盖您的订阅登录。
+Claude Code 正在使用来自已禁用 Console 组织的过时 `ANTHROPIC_API_KEY`。当您有保存的订阅登录时,密钥会覆盖它。
```text theme={null}
-Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your other credentials
+Your ANTHROPIC_API_KEY belongs to a disabled organization · Unset the environment variable to use your subscription instead
+Your ANTHROPIC_API_KEY belongs to a disabled organization · Update or unset the environment variable
API Error: 400 ... This organization has been disabled.
```
-环境变量优先于 `/login`,因此即使您有有效的 Pro 或 Max 订阅,在 shell 配置文件中导出或从 `.env` 文件加载的密钥也会被使用。在非交互模式 (`-p`) 中,当密钥存在时始终使用该密钥。
+`·` 之后的提示取决于您保存的凭证:当存储的 `/login` 可以在您取消设置密钥后接管时出现第一种形式,当密钥是您唯一的凭证时出现第二种形式。
+
+环境变量优先于 `/login`,因此在您的 shell 配置文件中导出或从 `.env` 文件加载的密钥即使您有有效的 Pro 或 Max 订阅也会被使用。在非交互式模式 (`-p`) 中,当存在密钥时始终使用该密钥。
**应该做什么:**
-* 在当前 shell 中取消设置 `ANTHROPIC_API_KEY` 并从 shell 配置文件中删除它,然后重新启动 `claude`
-* 之后运行 `/status` 确认活跃凭证是您的订阅
-* 如果未设置环境变量且错误仍然存在,则禁用的组织是与您的 `/login` 关联的组织。联系支持或使用不同的账户登录。
+* 在当前 shell 中取消设置 `ANTHROPIC_API_KEY` 并从您的 shell 配置文件中删除它,然后重新启动 `claude`
+* 如果消息说 `Update or unset`,您没有保存的登录可以回退。取消设置密钥并运行 `/login`,或将密钥替换为来自活跃 Console 组织的密钥。
+* 之后运行 `/status` 以确认活跃凭证是您的订阅
+* 如果未设置环境变量且错误仍然存在,则禁用的组织是与您的 `/login` 关联的组织。联系支持或使用不同账户登录。
您的组织已禁用 API 密钥身份验证
-此消息需要 Claude Code v2.1.169 或更高版本。您的 Console 组织管理员已关闭 API 密钥身份验证,因此 API 拒绝 Claude Code 发送的密钥。`·` 之后的恢复提示因密钥来源而异:
+此消息需要 Claude Code v2.1.169 或更高版本。您的 Console 组织的管理员已关闭 API 密钥身份验证,因此 API 拒绝 Claude Code 正在发送的密钥。`·` 之后的恢复提示因密钥来自何处而异:
```text theme={null}
Your organization has disabled API key authentication · Run /login to sign in with your claude.ai account
@@ -499,21 +987,21 @@ Your organization has disabled API key authentication · Unset ANTHROPIC_API_KEY
Your organization has disabled API key authentication · Unset the apiKeyHelper setting and run /login to sign in with your claude.ai account
```
-环境变量和 `apiKeyHelper` 优先于 `/login`,因此仅运行 `/login` 在任一仍在提供密钥时无法帮助。请参阅 [身份验证优先级](/docs/zh-CN/authentication#authentication-precedence)。
+环境变量和 `apiKeyHelper` 优先于 `/login`,因此仅运行 `/login` 在任一仍在提供密钥时没有帮助。请参阅 [身份验证优先级](/docs/zh-CN/authentication#authentication-precedence)。
**应该做什么:**
-* 如果消息提到 `ANTHROPIC_API_KEY`,在当前 shell 中取消设置它并从 shell 配置文件或 `.env` 文件中删除它,然后重新启动 `claude`
-* 如果消息提到 `apiKeyHelper`,从您的 `settings.json` 中删除 [`apiKeyHelper`](/docs/zh-CN/settings#available-settings) 设置
-* 运行 `/login` 使用您的 claude.ai 账户登录
-* 之后运行 `/status` 确认活跃凭证是您的订阅而不是 API 密钥
+* 如果消息命名 `ANTHROPIC_API_KEY`,在当前 shell 中取消设置它并从您的 shell 配置文件或 `.env` 文件中删除它,然后重新启动 `claude`
+* 如果消息命名 `apiKeyHelper`,从您的 `settings.json` 中删除 [`apiKeyHelper`](/docs/zh-CN/settings-reference#apikeyhelper) 设置
+* 运行 `/login` 以使用您的 claude.ai 账户登录
+* 之后运行 `/status` 以确认活跃凭证是您的订阅而不是 API 密钥
* 如果您需要 API 密钥身份验证用于自动化,请要求您的组织管理员在 Console 中重新启用它
您的组织已禁用 Claude 订阅访问
-您的 Claude 组织不允许使用订阅登录登录到 Claude Code。使用同一账户再次运行 `/login` 会返回相同的错误。
+您的 Claude 组织不允许使用订阅登录登录 Claude Code。使用同一账户再次运行 `/login` 会返回相同的错误。
```text theme={null}
Your organization has disabled Claude subscription access for Claude Code · Use an Anthropic API key instead, or ask your admin to enable access
@@ -521,19 +1009,19 @@ Your organization has disabled Claude subscription access for Claude Code · Use
这是服务器端组织设置,因此无法从本地设置、环境变量或 CLI 标志覆盖。
-Agent SDK 和 `-p` 非交互模式将其显示为 `oauth_org_not_allowed` 错误代码。
+Agent SDK 和 `-p` 非交互式模式将此显示为 `oauth_org_not_allowed` 错误代码。
**应该做什么:**
* 要求您的管理员为您的组织启用 Claude Code 访问
-* 使用 Console API 密钥而不是您的订阅进行身份验证。有关设置,请参阅 [Claude Console 身份验证](/docs/zh-CN/authentication#claude-console-authentication)。
+* 使用 Console API 密钥而不是您的订阅进行身份验证。请参阅 [Claude Console 身份验证](/docs/zh-CN/authentication#claude-console-authentication) 了解设置。
* 如果您是管理员且看不到启用访问的选项,请联系 [Anthropic 支持](https://support.claude.com)
例程被您的组织的策略禁用
-您的 Team 或 Enterprise 组织中的所有者已在组织级别关闭例程。当您尝试创建或运行例程时会出现该错误,包括从 `/schedule` 和 claude.ai/code 上的 [Routines](/docs/zh-CN/routines) UI。
+您的 Team 或 Enterprise 组织中的所有者已在组织级别关闭例程。当您尝试创建或运行例程时会出现错误,例如从 claude.ai/code 上的 [例程](/docs/zh-CN/routines) UI。在 Claude Code v2.1.227 或更高版本上,相同的设置也 [隐藏 CLI 中的 `/schedule`](/docs/zh-CN/routines#troubleshooting)。
```text theme={null}
Routines are disabled by your organization's policy.
@@ -553,842 +1041,3883 @@ Routines are disabled by your organization's policy.
会话不是直接与 Anthropic API 通信,因此没有 claude.ai 后端供 [Remote Control](/docs/zh-CN/remote-control) 配对。
```text theme={null}
-Remote Control is only available when using Claude via api.anthropic.com.
+Remote Control is only available when using Claude via api.anthropic.com. CLAUDE_CODE_USE_BEDROCK is set, so this session is using Amazon Bedrock — unset it (or run in a shell without it) to use Remote Control.
```
-这出现在 Amazon Bedrock、Google Cloud 的 Agent Platform 和 Microsoft Foundry 上。从 v2.1.196 开始,当 [`ANTHROPIC_BASE_URL`](/docs/zh-CN/env-vars) 指向 `api.anthropic.com` 以外的主机时,例如 [LLM 网关](/docs/zh-CN/llm-gateway) 或代理,即使您使用 claude.ai 登录,它也会出现。
+第二句解释了什么将会话路由离开 Anthropic API;在 v2.1.219 之前,消息仅为第一句。根据原因,消息命名:
+
+* `CLAUDE_CODE_USE_*` 提供商变量,例如 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock) 的 `CLAUDE_CODE_USE_BEDROCK` 或 [Google Cloud 的 Agent Platform](/docs/zh-CN/google-vertex-ai) 的 `CLAUDE_CODE_USE_VERTEX`
+* [`ANTHROPIC_BASE_URL`](/docs/zh-CN/env-vars) 指向 `api.anthropic.com` 以外的主机,例如 [LLM 网关](/docs/zh-CN/llm-gateway) 或代理,即使您使用 claude.ai 登录;在 v2.1.196 之前,自定义基础 URL 不会阻止 Remote Control
+* `ANTHROPIC_UNIX_SOCKET` 已设置,因此会话通过本地套接字而不是 `api.anthropic.com` 发送其请求
+* 企业 [云网关](/docs/zh-CN/claude-apps-gateway) 通过 `/login` 登录,不支持 Remote Control,没有变量可取消设置
**应该做什么:**
-* 取消设置 `ANTHROPIC_BASE_URL` 并重启会话,或从直接与 Anthropic API 通信的会话启动 Remote Control
-* 对于此错误和其他 Remote Control 启动消息,请参阅 [Remote Control 故障排除](/docs/zh-CN/remote-control#troubleshooting)
+* 取消设置消息命名的变量,例如 `CLAUDE_CODE_USE_BEDROCK` 或 `ANTHROPIC_BASE_URL`,并重新启动会话,或从直接与 Anthropic API 通信的会话启动 Remote Control
+* 如果变量未在您的 shell 中设置,请检查您的 [设置文件](/docs/zh-CN/settings#where-settings-live) 中的 `env` 键,该键将环境变量应用于每个会话
+* 对于此和其他 Remote Control 启动消息,请参阅 [Remote Control 故障排除](/docs/zh-CN/remote-control#troubleshooting)
-
- OAuth 令牌被撤销或过期
+
+ Remote Control 无法刷新您的登录
-您保存的登录不再有效。撤销的令牌意味着您在任何地方都已登出或管理员删除了访问权限;过期的令牌意味着自动刷新在会话中途失败。
+Claude Code 在短期凭证上运行实时 [Remote Control](/docs/zh-CN/remote-control) 连接,它使用您保存的 claude.ai 登录获取和更新这些凭证。当 claude.ai 停止接受该登录或 Claude Code 没有保存的登录时,Claude Code 停止 Remote Control 并需要您再次登录。任一故障都可能在 Claude Code 仍在连接时或稍后在更新凭证时发生。
-两条消息都报告 Claude Code 发送的请求 API 返回的拒绝。当保存的登录在失败的刷新后已被清除时,您会看到 [登录已过期](#login-expired) 代替。
+当 Claude Code 要求登录服务刷新您保存的登录并且没有得到答复时,它会保持 Remote Control 运行并在连接的当前凭证仍然有效时再次尝试刷新。当 Claude Code 无法到达登录服务、请求超时或服务在不拒绝您的登录的情况下失败时,刷新会得不到答复。如果当该凭证过期时登录服务仍然没有答复,Claude Code 会停止 Remote Control 并报告 `OAuth token refresh failed`。
+
+当 Claude Code 停止 Remote Control 时,它在警告和以 `Remote Control disconnected` 开头的成绩单行中显示原因。您的本地会话继续运行而没有 Remote Control。本部分涵盖这些行:
```text theme={null}
-OAuth token revoked · Please run /login
-OAuth token has expired · Please run /login
-API Error: 401 ... authentication_error
+Remote Control disconnected — Claude.ai login expired — run /login to restore Remote Control
+Remote Control disconnected — Claude.ai login expired — run /login, then /remote-control
+Remote Control disconnected — Claude.ai login was rejected — run /login, then /remote-control
+Remote Control disconnected — OAuth token unavailable — run /login to restore Remote Control
+Remote Control disconnected — OAuth token refresh failed — run /login to re-authenticate
+Remote Control disconnected — JWT refresh failed: no OAuth token — run /login
+Remote Control disconnected — Signed out of Claude — run /login, then /remote-control
```
+Claude Code 在消息中间命名原因:
+
+* ` Claude.ai login expired` 和 `Claude.ai login was rejected`:claude.ai 不再接受您保存的登录令牌,因为它已过期或被撤销
+* ` OAuth token unavailable`:当连接的凭证到期需要更新时,Claude Code 没有保存的登录令牌
+* `OAuth token refresh failed`:claude.ai 在 Claude Code 重新连接时拒绝了您保存的登录令牌,刷新令牌没有产生新令牌
+* `JWT refresh failed: no OAuth token`:Claude Code 找不到保存的登录令牌来更新
+* ` Signed out of Claude`:您在此机器上登出,例如在另一个终端中运行 `/logout`,因此 Claude Code 没有保存的登录来更新连接
+
**应该做什么:**
-* 运行 `/login` 重新登录
-* 如果在同一会话中重新身份验证后错误返回,请先运行 `/logout` 完全清除存储的令牌,然后运行 `/login`
-* 对于跨启动的重复登录提示,请参阅 [故障排除](/docs/zh-CN/troubleshoot-install#not-logged-in-or-token-expired) 中的系统时钟和 macOS Keychain 检查
-* 对于其他故障,包括 `403 Forbidden` 和 OAuth 浏览器问题,请参阅 [登录和身份验证](/docs/zh-CN/troubleshoot-install#login-and-authentication)
+* 运行 `/login` 再次登录
+* 运行 `/remote-control` 重新连接会话。以 `run /login to restore Remote Control` 结尾的消息不需要此步骤:Claude Code 在您登录后自动重新连接。
-
- 登录已过期
-
+在 v2.1.224 之前,`OAuth token refresh failed — run /login to re-authenticate` 读作 `OAuth token refresh failed — re-authenticate, then re-enable Remote Control`,`JWT refresh failed: no OAuth token — run /login` 读作 `no OAuth token available for recovery (code )`。` Claude.ai login expired`、`Claude.ai login was rejected` 和 `OAuth token unavailable` 消息在 v2.1.225 中添加。
-Claude Code 尝试更新您保存的 claude.ai 或 Claude Console 登录,OAuth 服务拒绝了存储的刷新令牌,因此 Claude Code 清除了保存的凭证。之后,每个请求在到达 API 之前都会在本地停止,因为只有 `/login` 可以创建新凭证。在 v2.1.206 之前,Claude Code 无论如何都会发送请求,使用环境中剩余的任何凭证,然后每个模型都会失败,显示 [所选模型有问题](#theres-an-issue-with-the-selected-model) 或 401 而不是登录提示。
+在 v2.1.238 之前,Claude Code 将现在说 `Signed out of Claude` 的情况报告为 `JWT refresh failed: no OAuth token — run /login`,并在一次登录刷新没有得到答复后立即停止 Remote Control,显示 `Claude.ai login expired — run /login to restore Remote Control`。
-```text theme={null}
-Login expired · Please run /login
-```
+
+ Remote Control 停止,因为登录账户已更改
+
+
+Claude Code 在 [Remote Control](/docs/zh-CN/remote-control) 会话期间显示此行,当您在此机器上登录到不同的 claude.ai 账户或组织时。您在 Claude Code 会话外进行了切换,例如在另一个终端中运行 `/login`。
-在 [非交互模式](/docs/zh-CN/headless) (`-p`) 和 [Agent SDK](/docs/zh-CN/agent-sdk/overview) 中,消息如下所示,结构化错误代码为 `authentication_failed`:
+您在通过 `/login` 登录时启动的 Remote Control 会话属于当时登录的 claude.ai 账户和组织。
```text theme={null}
-Failed to authenticate: OAuth session expired and could not be refreshed
+Remote Control disconnected — signed-in claude.ai account or organization changed on this machine — run /remote-control to start a session for the current account, or /login to switch back, then /remote-control
```
-这与 [OAuth 令牌被撤销或过期](#oauth-token-revoked-or-expired) 的状态不同。这些消息报告 API 返回的 401。Claude Code 本身为已失败刷新的登录生成 `Login expired`,因此它不发送请求。
-
-使用 API 密钥、[`CLAUDE_CODE_OAUTH_TOKEN`](/docs/zh-CN/env-vars) 或第三方提供商进行身份验证的会话不使用保存的登录,永远不会看到此消息。
+Claude Code 在 claude.ai 确认账户或组织已更改后立即停止 Remote Control 会话。您的本地会话继续运行而没有 Remote Control。
**应该做什么:**
-* 运行 `/login` 重新登录。不登录重试会在每个请求上显示相同的消息。
-* 在非交互模式中,在同一环境中运行 `claude`,完成 `/login`,然后重新运行您的命令。对于无法交互式登录的自动化,使用 `ANTHROPIC_API_KEY` 进行身份验证或 [使用 `claude setup-token` 生成长期令牌](/docs/zh-CN/authentication#generate-a-long-lived-token)。
-* 如果登录持续失败,请参阅 [登录和身份验证](/docs/zh-CN/troubleshoot-install#login-and-authentication)
+* 运行 `/remote-control` 在当前账户或组织下启动新的 Remote Control 会话
+* 要切换回去,运行 `/login` 并再次登录到之前的账户或组织。然后运行 `/remote-control`。
-
- OAuth 范围要求
+在 v2.1.234 之前,Claude Code 在您在 Claude Code 会话外切换到不同账户或组织时没有注意到。Claude Code 保持 Remote Control 会话连接,直到稍后对 Remote Control 服务器的请求失败,显示 `Remote Control server rejected the request (HTTP 404)`。该故障可能在切换后数小时发生。
+
+
+ Remote Control 停止,因为运行会话的应用登出或切换了账户
-存储的令牌早于较新功能需要的权限范围。您最常从 `/usage` 和状态行使用情况指示器看到这一点:
+当 Claude 桌面应用或 IDE 托管您的会话时,Claude Code 从该应用而不是从 `/login` 获取其登录令牌。当 claude.ai 拒绝该令牌时,Claude Code 要求应用提供新令牌。如果应用回答说它已登出或现在登录到不同的 Claude 账户,Claude Code 结束 [Remote Control](/docs/zh-CN/remote-control) 会话并向应用发送以下行之一:
```text theme={null}
-OAuth token does not meet scope requirement: user:profile
+Remote Control stopped — the app running this session is now signed in to a different Claude account
+Remote Control stopped — the app running this session is signed out of Claude. Sign in there, then turn Remote Control back on
```
+您的本地会话继续运行而没有 Remote Control。
+
**应该做什么:**
-* 运行 `/login` 获取具有当前范围的新令牌。您不需要先登出。
+* 如果应用已登出,再次登录,然后在应用中重新打开 Remote Control
+* 如果应用切换了账户,Claude Code 无法在新账户下继续已结束的会话。在该账户下启动新的 Remote Control 会话。
-
- AWS 凭证已过期或无效
+在 v2.1.238 之前,Claude Code 在两种情况下都向应用发送了 [Remote Control 无法刷新您的登录](#remote-control-couldnt-refresh-your-login) 下列出的 `run /login` 消息。
+
+
+ OAuth 令牌被撤销或过期
-此消息需要 Claude Code v2.1.198 或更高版本,仅当在您的设置文件中设置了 [`awsAuthRefresh`](/docs/zh-CN/amazon-bedrock#advanced-credential-configuration) 时才会出现。您的 AWS 会话令牌已过期或被拒绝,Claude Code 已运行的自动刷新未产生 API 接受的凭证。它出现在来自 [Claude Platform on AWS](/docs/zh-CN/claude-platform-on-aws) 或 [Mantle 端点](/docs/zh-CN/amazon-bedrock#use-the-mantle-endpoint) 的 401 上,这是这些提供商报告过期安全令牌的方式。
+您保存的登录不再有效。被撤销的令牌意味着您在任何地方登出或管理员删除了访问权限;过期的令牌意味着自动刷新在会话中失败。
-中间的操作提示命名了您的设置中的 `awsAuthRefresh` 命令,因此它会有所不同。稳定的部分是前导的 `AWS credentials expired or invalid`:
+两条消息都报告 API 为 Claude Code 发送的请求返回的拒绝。当保存的登录在失败的刷新后已被清除时,您会看到 [登录过期](#login-expired)。如果您使用 [`CLAUDE_CODE_OAUTH_TOKEN`](/docs/zh-CN/env-vars) 中的长期令牌进行身份验证,当该令牌过期或被撤销时,您会看到相同的消息。
```text theme={null}
-AWS credentials expired or invalid · run /login and select "Claude Platform on AWS · refresh credentials", or run `aws sso login --profile myprofile` in another terminal · API Error: 401 ...
+OAuth token revoked · Please run /login
+Please run /login · API Error: 401 OAuth token has expired ...
```
-如果未配置 `awsAuthRefresh`,相同的 401 会显示通用的 `Please run /login` 消息,该消息无法刷新 AWS 凭证。
-
**应该做什么:**
-* 在另一个终端中运行消息中命名的 `awsAuthRefresh` 命令,例如 `aws sso login --profile myprofile`,完成浏览器登录,然后重试
-* 在交互式会话中,运行 `/login`,选择 **3rd-party platform**,然后在 **Using 3rd-party platforms** 下选择 **Claude Platform on AWS · refresh credentials** 以运行相同的命令而无需重启 Claude Code。请参阅 [配置 AWS 凭证](/docs/zh-CN/claude-platform-on-aws#1-configure-aws-credentials)
-* 如果刷新命令成功后错误重复出现,请在同一 shell 和配置文件中使用 `aws sts get-caller-identity` 确认身份在 Claude Code 外部有效
+* 运行 `/login` 再次登录
+* 如果重新身份验证后错误在同一会话中返回,首先运行 `/logout` 以完全清除存储的令牌,然后运行 `/login`
+* 如果您使用 `CLAUDE_CODE_OAUTH_TOKEN` 环境变量进行身份验证,Claude Code 在请求失败并显示 401 后会继续发送您设置的值,而不是切换到保存的登录的令牌。[`/status`](/docs/zh-CN/commands) 将此凭证显示为读取 `CLAUDE_CODE_OAUTH_TOKEN` 的 `Auth token` 行。使用 [`claude setup-token`](/docs/zh-CN/authentication#generate-a-long-lived-token) 生成新令牌并使用它重新启动,或取消设置变量并运行 `/login`。在 v2.1.225 之前,Claude Code 可以在会话中用保存的登录的短期访问令牌替换变量的值,一旦该令牌过期,会话再次失败并显示 401 错误。
+* 对于跨启动的重复登录提示,请参阅 [故障排除](/docs/zh-CN/troubleshoot-install#not-logged-in-or-token-expired) 中的系统时钟检查和 macOS 凭证存储恢复步骤
+* 对于其他故障,包括 `403 Forbidden` 和 OAuth 浏览器问题,请参阅 [登录和身份验证](/docs/zh-CN/troubleshoot-install#login-and-authentication)
-
- AWS 身份验证失败
+
+ API 错误:401 无效的身份验证凭证
-此消息需要 Claude Code v2.1.198 或更高版本,仅当在您的设置文件中设置了 [`awsAuthRefresh`](/docs/zh-CN/amazon-bedrock#advanced-credential-configuration) 时才会出现。您的 AWS 提供商返回了 403,或 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock) 返回了 401。
-
-Claude Code 无法判断您遇到了哪个原因。Amazon Bedrock 将过期的安全令牌报告为 403,但 403 也是它报告授权拒绝的方式,例如来自缺失 IAM 权限或未为您的账户启用的模型的 `AccessDeniedException`。
-
-来自 Amazon Bedrock 的 401 也会落在这里而不是在 [AWS 凭证已过期或无效](#aws-credentials-expired-or-invalid) 下,因为 Amazon Bedrock 不会将过期令牌报告为 401。来自该端点的 401 通常来自请求路径中的其他内容,例如公司代理。
-
-凭证刷新可以修复过期的令牌,无法修复其他原因,因此消息提供两者:
+API 识别了您凭证的格式,但拒绝了其背后的账户或组织。当凭证最近被撤销、组织被禁用或删除了您的访问权限或账户本身被停用时,Anthropic 返回此消息,因此过期的令牌不是原因。凭证可以是您保存的登录或批准的 `ANTHROPIC_API_KEY`,修复方式不同,因此首先运行 `/status` 查看哪个处于活跃状态。
```text theme={null}
-AWS authentication failed · run /login and select "Claude Platform on AWS · refresh credentials", or run `aws sso login --profile myprofile` in another terminal · if credentials are current, check AWS permissions and model access · API Error: 403 ...
+Please run /login · API Error: 401 Invalid authentication credentials
```
-中间的操作提示命名了您的设置中的 `awsAuthRefresh` 命令,因此它会有所不同。稳定的部分是前导的 `AWS authentication failed`。
-
**应该做什么:**
-* 运行消息中命名的 `awsAuthRefresh` 命令或 `aws sso login`,以防过期凭证是原因
-* 如果您的凭证是最新的,请确认 [IAM 配置](/docs/zh-CN/amazon-bedrock#iam-configuration) 中的 IAM 权限已附加到您使用的身份,并且所选模型已为您的账户和区域启用
-* 运行 `aws sts get-caller-identity` 确认您的请求使用哪个身份;过时的 `AWS_PROFILE` 或默认配置文件是权限不匹配的常见原因
+* 如果 `/status` 显示未标记为未使用的 `API key` 行,则批准的 [`ANTHROPIC_API_KEY`](/docs/zh-CN/authentication#authentication-precedence) 是活跃凭证并优先于您的登录,因此 `/login` 不会替换它。在 Claude Console 中轮换密钥,或通过运行 `unset ANTHROPIC_API_KEY` 回退到您的订阅,或在 PowerShell 中运行 `Remove-Item Env:ANTHROPIC_API_KEY`。
+* 如果 `/status` 仅显示您的登录,运行 `/login` 一次。如果凭证被撤销,新登录会替换它。
+* 如果相同的消息对相同的登录账户返回,则该账户或组织不再活跃。检查 `/status` 报告的账户和组织,并要求您的组织管理员恢复访问。
+* 如果 [`ANTHROPIC_BASE_URL`](/docs/zh-CN/env-vars) 指向 [LLM 网关](/docs/zh-CN/llm-gateway),`401` 之后的文本是您网关的消息而不是 Anthropic 的,`/login` 不会改变它。改为修复您的网关期望的凭证。
-
- AWS 默认链凭证解析超时
+
+ 登录过期
-AWS 默认凭证提供商链在 60 秒内未产生凭证,因此 Claude Code 停止了解析并使请求失败。故障是本地凭证解析:请求从未到达 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock)、[Claude Platform on AWS](/docs/zh-CN/claude-platform-on-aws) 或 [Mantle 端点](/docs/zh-CN/amazon-bedrock#use-the-mantle-endpoint)。Claude Code 在此错误浮出之前清除其 [凭证缓存](/docs/zh-CN/amazon-bedrock#credential-caching-and-resolution-timeout) 并重试,因此到您看到它时链已在重复尝试上停滞。
+Claude Code 尝试更新您保存的 claude.ai 或 Claude Console 登录,OAuth 服务拒绝了存储的刷新令牌,因此 Claude Code 清除了保存的凭证。之后,每个模型请求在到达 API 之前都会在本地停止,显示此消息,因为只有 `/login` 可以创建新凭证。
+
+在 v2.1.206 之前,Claude Code 无论如何都会发送模型请求,使用环境中剩余的任何凭证,每个模型都会失败,显示 [所选模型有问题](#theres-an-issue-with-the-selected-model) 或 401,而不是登录提示。
```text theme={null}
-API Error: AWS default-chain credential resolve timed out
+Login expired · Please run /login
```
-常见原因是 AWS 配置文件中的 `credential_process` 命令等待它无法接收的输入,以及容器或 VM 的实例元数据服务 (IMDS) 从不回答链的探测。在 v2.1.207 之前,停滞的链使请求无限期等待而不是以此消息失败。
+在 [非交互式模式](/docs/zh-CN/headless) (`-p`) 和 [Agent SDK](/docs/zh-CN/agent-sdk/overview) 中,消息如下所示,结构化错误代码为 `authentication_failed`:
-**应该做什么:**
+```text theme={null}
+Failed to authenticate: OAuth session expired and could not be refreshed
+```
-* 在同一 shell 中使用相同的 `AWS_PROFILE` 运行 `aws sts get-caller-identity`。如果它也挂起,请修复配置文件;提示交互式的 `credential_process` 命令是常见原因。
-* 在启动 Claude Code 之前完成登录步骤,例如 `aws sso login --profile myprofile`,以便链从本地 SSO 缓存解析而不是等待浏览器流
-* 如果您的链运行合法需要超过 60 秒的交互式登录,例如通过 `aws-vault` 等包装器的带 MFA 的 SSO,请使用 [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](/docs/zh-CN/env-vars) 以毫秒为单位提高限制
+这与 [OAuth 令牌被撤销或过期](#oauth-token-revoked-or-expired) 的状态不同。这些消息报告 API 返回的拒绝。Claude Code 本身为已失败更新的登录生成 `Login expired`,因此它不发送请求。当更新失败是因为账户本身被暂停而不是登录过时时,Claude Code 改为显示 [您的账户被冻结](#your-account-is-on-hold)。
-
- 网络和连接错误
-
+使用 API 密钥、[`CLAUDE_CODE_OAUTH_TOKEN`](/docs/zh-CN/env-vars) 或第三方提供商进行身份验证的会话不使用保存的登录,永远不会看到此消息。
-这些错误表示来自 Claude Code 的网络请求未能到达其目的地,或 Claude Code 和 API 之间的某些东西在返回途中改变了响应。它们通常源于您的本地网络、代理或防火墙,或云环境的网络策略。
+您可以在请求失败之前检查此状态:[`/status`](/docs/zh-CN/commands) 显示读取 `Expired — log in again` 的 `Login` 行,加上它为过期登录保存的组织和电子邮件。该行仅在保存的登录是您的活跃凭证且无法再刷新时出现。以其他方式进行身份验证的会话不显示该行,即使过期的登录仍然保存。在 v2.1.210 之前,`/status` 在此状态下没有指示登录曾经存在过,因为清除的凭证使其无法报告。
-
- 无法连接到 API
+**应该做什么:**
+
+* 运行 `/login` 再次登录。在不登录的情况下重试会在每个请求上显示相同的消息。
+* 在非交互式模式中,在同一环境中运行 `claude`,完成 `/login`,然后重新运行您的命令。对于无法交互式登录的自动化,使用 `ANTHROPIC_API_KEY` 进行身份验证或 [使用 `claude setup-token` 生成长期令牌](/docs/zh-CN/authentication#generate-a-long-lived-token)。
+* 如果登录持续失败,请参阅 [登录和身份验证](/docs/zh-CN/troubleshoot-install#login-and-authentication)
+
+
+ Claude 登录未被接受
-与 API 的 TCP 连接失败或从未完成。
+您尝试启动 [云会话](/docs/zh-CN/claude-code-on-the-web),服务器拒绝使用 401 创建它:它不接受此机器发送的 Claude 登录,通常是因为登录过期或被撤销。
+
+当服务器给出自己的原因时,行的第一部分是该原因。否则该行读作:
```text theme={null}
-Unable to connect to API. Check your internet connection
-Unable to connect to API (ECONNREFUSED)
-Unable to connect to API (ECONNRESET)
-Unable to connect to API (ETIMEDOUT)
-fetch failed
-Request timed out. Check your internet connection and proxy settings
+Claude login not accepted · Run /login, then try again
```
-常见原因包括没有互联网访问、阻止 `api.anthropic.com` 的 VPN,或未配置的必需企业代理。
-
**应该做什么:**
-* 通过在同一 shell 中运行 `curl -I https://api.anthropic.com` 来确认您可以到达 API 主机。在 Windows PowerShell 上使用 `curl.exe -I https://api.anthropic.com`,以便不使用内置的 `Invoke-WebRequest` 别名。
-* 如果您在企业代理后面,请在启动 Claude Code 之前设置 `HTTPS_PROXY`,并参阅[网络配置](/docs/zh-CN/network-config)
-* 如果您通过 LLM 网关或中继路由,请将 [`ANTHROPIC_BASE_URL`](/docs/zh-CN/env-vars) 设置为其地址。有关设置,请参阅[将 Claude Code 连接到 LLM 网关](/docs/zh-CN/llm-gateway-connect)。
-* 确保您的防火墙允许[网络访问要求](/docs/zh-CN/network-config#network-access-requirements)中列出的主机
-* 间歇性故障会[自动重试](#automatic-retries);持续故障指向本地网络问题
-
-如果 `curl` 成功但 Claude Code 仍然失败,原因通常是运行时和网络之间的某些东西,而不是网络本身:
-
-* 在 Linux 和 WSL 上,检查 `/etc/resolv.conf` 是否有无法到达的名称服务器。特别是 WSL 可能会从主机继承损坏的解析器。
-* 在 macOS 上,已断开连接或卸载的 VPN 客户端可能会留下隧道接口或路由规则。检查 `ifconfig` 是否有过时的 `utun` 接口,并在系统设置中删除 VPN 的网络扩展。
-* Docker Desktop 和类似的容器运行时可能会拦截出站流量。退出它们并重试以排除这种可能性。
+* 运行 `/login`,完成登录,然后再次启动会话
-
- Bedrock 流式响应具有意外的内容类型
+
+ 工件需要 claude.ai 登录
-Claude Code 和 [Amazon Bedrock](/docs/zh-CN/amazon-bedrock) 之间的网关或代理正在转换流式响应体或其 `Content-Type` 标头。Amazon Bedrock 将响应流式传输为 `application/vnd.amazon.eventstream`,Claude Code 拒绝报告不同内容类型的成功流式响应,而不是解码它无法读取的响应体。请求不会重试。
+Claude Code 拒绝了 [工件](/docs/zh-CN/artifacts) 发布或读取,因为会话没有可用于工件的 claude.ai 登录。
+
+消息的每种形式都以相同的词开头,然后是取决于您的会话如何进行身份验证的补救措施。没有竞争凭证时,它读作:
```text theme={null}
-Bedrock streaming response has content-type "text/event-stream"; expected "application/vnd.amazon.eventstream". A gateway or proxy between Claude Code and Bedrock is likely transforming the response body — Bedrock's binary event-stream format must be passed through unmodified. Set CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD=1 to suppress this check while the gateway is being fixed.
+Artifacts need a claude.ai login. Run /login and select "Claude account with subscription", then retry — the "Anthropic Console account" option does not provide claude.ai credentials.
```
-在 v2.1.208 之前,相同的配置错误表现为 `API Error: Truncated event message received`,在整个响应被缓冲后出现。
-
**应该做什么:**
-* 配置网关以不修改地传递 `InvokeModelWithResponseStream` 响应体及其 `Content-Type` 标头。将流重新发出为服务器发送事件的中介是常见原因。
-* 如果网关仅重写标头并完整传递二进制体,请设置 [`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD=1`](/docs/zh-CN/env-vars) 以跳过检查,直到网关被修复。请参阅[网关或代理后的流式错误](/docs/zh-CN/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy)。
+* 运行 `/login` 并选择 **Claude account with subscription**。**Anthropic Console account** 选项不提供 claude.ai 凭证。
+* 当消息命名优先的凭证(如 `ANTHROPIC_API_KEY`、`apiKeyHelper` 设置或之前 `/login` 保存的 Console 密钥)时,按消息说的方式删除它,然后运行 `/login`
+* 当消息说此远程会话通过启动它的机器进行身份验证时,在该机器上登录到 claude.ai,然后重新连接会话
+* 当消息说凭证由会话的主机环境注入时,您无法在该会话中更改它;启动登录到 claude.ai 的会话
+* 请参阅 [可用性](/docs/zh-CN/artifacts#availability) 了解工件具有的其他要求,例如计划、模型提供商和组织策略
-
- SSL 证书错误
+
+ 管理员策略需要 Cloud gateway 登录
-您网络上的代理或安全设备正在用其自己的证书拦截 TLS 流量,而 Claude Code 不信任它。
+管理员在此机器上的 [托管设置](/docs/zh-CN/managed-settings) 将 [`forceLoginMethod`](/docs/zh-CN/settings-reference#forceloginmethod) 设置为 `"gateway"` 或设置 [`forceLoginGatewayUrl`](/docs/zh-CN/settings-reference#forcelogingatewayurl)。除非您通过 `CLAUDE_CODE_USE_BEDROCK` 等变量选择云提供商,Claude Code 仅接受 [Claude apps gateway](/docs/zh-CN/claude-apps-gateway) 登录。您会看到两条消息之一:
```text theme={null}
-Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates
-Unable to connect to API: Self-signed certificate detected
+Not signed in to the Cloud gateway — run /login.
```
-从 v2.1.199 开始,证书验证失败不会重试,因此此错误在第一次尝试时出现,而不是在完整[重试预算](#automatic-retries)之后。早期版本在显示它之前花费几分钟重试。瞬时 TLS 条件(例如握手超时)仍然会重试。
+当会话没有网关登录时,模型请求失败,显示此消息,例如因为您自策略到达机器后未运行 `/login`。
-在 `/login` 和启动连接检查期间,使用 OpenSSL 代码和内联修复报告相同的失败:
+如果您还配置了 `ANTHROPIC_API_KEY`、`ANTHROPIC_AUTH_TOKEN` 或 `apiKeyHelper` 凭证,且托管设置设置了 `forceLoginMethod`,Claude Code 在启动时改为以以下消息退出:
```text theme={null}
-SSL certificate error (UNABLE_TO_GET_ISSUER_CERT_LOCALLY). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run `claude doctor` for details.
+Administrator policy requires a Cloud gateway sign-in on this machine; the
+Anthropic-issued credential configured here (ANTHROPIC_API_KEY,
+ANTHROPIC_AUTH_TOKEN, or apiKeyHelper) is not used.
```
**应该做什么:**
-* 导出您组织的 CA 包,并使用 `NODE_EXTRA_CA_CERTS=/path/to/ca-bundle.pem` 将 Claude Code 指向它
-* 有关完整设置说明,请参阅[网络配置](/docs/zh-CN/network-config#custom-ca-certificates)
-* 不要设置 `NODE_TLS_REJECT_UNAUTHORIZED=0`,这会完全禁用证书验证
+* 运行 `/login` 并在 **Cloud gateway** 屏幕上完成登录
+* 对于启动消息,删除您配置的 `ANTHROPIC_API_KEY`、`ANTHROPIC_AUTH_TOKEN` 或 `apiKeyHelper` 设置,然后启动 `claude` 并运行 `/login`
+* 如果您认为机器不应该需要网关,请要求管理该机器的管理员从其托管设置中删除 `forceLoginMethod` 和 `forceLoginGatewayUrl`
-
- 云会话中不允许的主机
+在 v2.1.265 上,回归也在某些 LLM 网关和代理配置中显示第一条消息,这些配置使用 API 密钥、`apiKeyHelper` 或自定义标头进行身份验证,即使机器上没有管理员要求。更新到 v2.1.266 或更高版本。您不需要更改您的配置。
+
+在 v2.1.261 之前,在将 `forceLoginMethod` 设置为 `"gateway"` 的机器上,Claude Code 使用剩余的保存登录而不是失败模型请求,并使用 `This machine's managed settings require a first-party login` 而不是启动消息报告配置的环境凭证。在 v2.1.265 之前,其托管设置仅设置 `forceLoginGatewayUrl` 的机器不需要网关登录,Claude Code 在那里使用剩余凭证。
+
+
+ 您的账户被冻结
-来自云会话或例程的出站 HTTP 请求被环境的网络策略阻止。
+您的 Claude 账户背后的登录已被暂停。Claude Code 在尝试更新您保存的登录并了解冻结时显示第一条消息,在您在浏览器中完成的登录报告时显示第二条消息:
```text theme={null}
-HTTP 403
-x-deny-reason: host_not_allowed
+Your account is on hold and can't use Claude Code. View details or appeal: https://claude.ai/restricted
+Your account is on hold and can't sign in to Claude Code. View details or appeal: https://claude.ai/restricted
```
-您也可能看到与目的地真实证书不匹配的 TLS 证书。云环境通过代理路由出站流量以强制执行网络策略,因此证书不匹配意味着代理终止了连接,而不是目的地。
-
-这不是客户端网络问题。云会话和[例程](/docs/zh-CN/routines)在沙箱环境内运行,其出站流量被过滤到环境的允许列表。**默认**环境使用**受信任**访问,允许[默认允许列表](/docs/zh-CN/claude-code-on-the-web#default-allowed-domains)中的包注册表、云提供商 API、容器注册表和常见开发域,但阻止其他所有内容。
+使用同一账户再次登录不会清除消息,因为冻结是在账户上而不是登录上。在 [非交互式模式](/docs/zh-CN/headless) (`-p`) 和 [Agent SDK](/docs/zh-CN/agent-sdk/overview) 中,结构化错误代码为 `account_on_hold`。在 v2.1.235 之前,Claude Code 将被冻结的账户报告为 [登录过期 · 请运行 /login](#login-expired),其恢复步骤无法清除冻结。
**应该做什么:**
-* 打开例程进行编辑,或启动云会话。选择显示您的环境名称(例如**默认**)的云图标以打开选择器。将鼠标悬停在您的环境上,然后单击设置图标。
-* 在**更新云环境**对话框中,将**网络访问**从**受信任**更改为**自定义**,然后将被阻止的域添加到**允许的域**。每行输入一个域。选中**也包括常见包管理器的默认列表**以在自定义域旁边保留[默认允许列表](/docs/zh-CN/claude-code-on-the-web#default-allowed-domains)。如果您想要不受限制的访问,请改为选择**完全**。
-* 单击**保存更改**。下一次运行使用更新的允许列表。
-
-有关访问级别和默认允许列表,请参阅[网络访问](/docs/zh-CN/claude-code-on-the-web#network-access)。本地 CLI 会话不受此策略影响。
+* 打开消息中的链接以查看冻结的详细信息或对其提出上诉
+* 如果您有另一个 Claude 账户或不受冻结影响的 API 密钥,您可以在冻结解决期间继续工作:使用该账户运行 `/login`,或使用 `ANTHROPIC_API_KEY` 设置密钥
-
- 无法重新连接到您的 Remote Control 会话
+
+ Anthropic 配置文件登录过期
+Claude Code 通过 Anthropic 凭证配置文件进行身份验证,其保存的登录凭证已过期,且配置文件不包含 Claude Code 可用于更新它的刷新凭证。Claude Code 在本地停止每个请求而不重试,因为重试会读取相同的过期凭证。
+
```text theme={null}
-Couldn't reconnect to your Remote Control session. Retry, or start a fresh session without --resume.
+Anthropic profile login expired · Re-authenticate your Anthropic profile
+Anthropic profile login expired · Run /login to use your claude.ai account instead, or re-authenticate the profile
```
-使用 `claude --resume` 或 `claude --continue` 恢复会重新连接到该对话中记录的 [Remote Control](/docs/zh-CN/remote-control) 会话。此消息意味着重新连接因可能是临时的原因(例如网络中断或服务器错误)而失败,因此 Claude Code 无法确认远程会话是否仍然存在。您的本地会话继续运行而不使用 Remote Control。
-
-**应该做什么:**
+这仅在活跃凭证来自 Anthropic 凭证配置文件时出现,您使用 `ANTHROPIC_PROFILE` 环境变量选择该文件,Claude Code 从您的 Anthropic 配置目录中发现为活跃配置文件,或 Claude Code 在您 [不使用 API 密钥登录](/docs/zh-CN/authentication#sign-in-without-an-api-key) 时写入。使用 `/login` 的 claude.ai 选项、API 密钥、持有者令牌(如 `ANTHROPIC_AUTH_TOKEN`)或第三方提供商进行身份验证的会话永远不会看到此消息。
-* 运行 `/remote-control` 以重试连接
-* 启动 Claude Code 而不使用 `--resume` 以创建新的 Remote Control 会话
-* 有关其他 Remote Control 启动消息,请参阅[排查 Remote Control 故障](/docs/zh-CN/remote-control#troubleshooting)
+在 [提供无密钥登录](/docs/zh-CN/authentication#sign-in-without-an-api-key) 的机器上,运行 `/login`,选择 Anthropic Console 账户,并再次登录以更新无密钥 Console 登录或 Claude Platform CLI 的 `ant auth login` 写入的配置文件。Claude Code 替换该配置文件中的过期凭证。对于联合配置文件或另一个工具创建的配置文件,`/login` 不会更新凭证。您看到的形式取决于您是否显式选择了配置文件或 Claude Code 发现了它:
-当服务器确认前一个会话不再存在时,您不会看到此消息;Claude Code 在这种情况下会创建一个新的会话。在 v2.1.200 之前,任何重新连接失败都会创建一个新的 Remote Control 会话,这在 claude.ai/code 的会话列表中留下了额外的会话。
+* 当您显式设置 `ANTHROPIC_PROFILE` 时,消息以 `Re-authenticate your Anthropic profile` 结尾。
+* 当 Claude Code 从您的配置目录发现配置文件时,消息提供 `/login`,因为 Claude Code 给予工作的 `/login` 优先于发现的配置文件,然后改为使用您的 claude.ai 或 Console 账户进行身份验证。在 v2.1.234 之前,Claude Code 在这种情况下也显示 `Re-authenticate your Anthropic profile` 形式。
-
- 请求错误
-
+**应该做什么:**
-这些错误与您的请求内容有关。大多数来自 API 在拒绝请求后的返回;少数是由 Claude Code 在发送任何请求之前在本地生成的。
+* 再次登录到配置文件,然后重试:在 [提供无密钥登录](/docs/zh-CN/authentication#sign-in-without-an-api-key) 的机器上,运行 `/login` 并为无密钥 Console 登录或 Claude Platform CLI 的 `ant auth login` 写入的配置文件选择 Anthropic Console 账户;对于其他配置文件,使用创建它们的工具
+* 如果管理员配置了配置文件的凭证,请要求他们颁发新凭证
+* 运行 `/status` 以确认活跃凭证源和配置文件名称
+* 要停止使用配置文件,如果您设置了 `ANTHROPIC_PROFILE`,则取消设置它,然后以其他方式进行身份验证,例如 `/login` 或 `ANTHROPIC_API_KEY`
-
- Prompt is too long
+
+ OAuth 范围要求
-对话加上附加文件超过了模型的上下文窗口。
+存储的令牌早于较新功能需要的权限范围。您最常从 `/usage` 和状态行使用指示器看到这种情况:
```text theme={null}
-Prompt is too long
+OAuth token does not meet scope requirement: user:profile
```
**应该做什么:**
-* 运行 `/compact` 来总结早期的回合并释放空间,或运行 `/clear` 来重新开始
-* 运行 `/context` 来查看消耗窗口的内容分解:系统提示、工具、内存文件和消息
-* 使用 `/mcp disable ` 禁用您未使用的 MCP 服务器,以从上下文中移除其工具定义
-* 修剪大型 `CLAUDE.md` 内存文件,或将说明移到[路径范围规则](/docs/zh-CN/memory#path-specific-rules)中,这些规则仅在相关时加载
-* 子代理从父会话继承每个 MCP 工具定义,这可能会在第一个回合之前填满它们的上下文窗口。在生成子代理之前禁用您未使用的 MCP 服务器。
-* 自动压缩默认启用,通常可以防止此错误。如果您设置了 [`DISABLE_AUTO_COMPACT`](/docs/zh-CN/env-vars),请重新启用它或在窗口填满之前手动运行 `/compact`。
+* 运行 `/login` 以获取具有当前范围的新令牌。您不需要先登出。
-请参阅[探索上下文窗口](/docs/zh-CN/context-window)以获得上下文如何填充的交互式视图。
-
-
- Error during compaction: Conversation too long
+
+ claude.ai 拒绝了会话令牌
-`/compact` 本身失败,因为没有足够的可用上下文来容纳它生成的摘要。
+[claude.ai 连接器](/docs/zh-CN/mcp#use-mcp-servers-from-claude-ai) 请求失败,因为 claude.ai 拒绝了您的 Claude Code 登录中的令牌,通常是已过期且无法刷新的登录。被拒绝的令牌是您的登录,而不是连接器在 claude.ai 中的自己的授权,因此再次授权连接器不会解决它。在 `/mcp` 中,连接器显示为 `connected · session token rejected`,其详细视图读作:
```text theme={null}
-Error during compaction: Conversation too long. Press esc twice to go up a few messages and try again.
+claude.ai rejected the session token. Run /login, then reconnect.
```
-当窗口在自动压缩触发时已经满了,或者在看到 `Prompt is too long` 后运行 `/compact` 时,可能会发生这种情况。
-
**应该做什么:**
-* 按 Esc 两次打开消息列表并回退几个回合。这会从上下文中删除最近的消息。然后再次运行 `/compact`。
-* 如果回退没有释放足够的空间,运行 `/clear` 来启动新的会话。您之前的对话会被保留,可以使用 `/resume` 重新打开。
+* 运行 `/login` 再次登录
+* 从 `/mcp` 重新连接连接器,或运行 `/mcp reconnect `。在您再次登录之前重新连接会使连接器处于相同状态。`/mcp` 面板的 **Reconnect** 选项报告 `your claude.ai session token was rejected`;输入的 `/mcp reconnect ` 形式报告成功重新连接,即使令牌仍然被拒绝。
-
- Request too large
+在 v2.1.222 之前,Claude Code 改为将连接器标记为需要身份验证,这指向您连接器的授权流程,即使完成它也不会解决状态。
+
+
+ MCP 服务器需要您再次登录
-原始请求体在标记化之前超过了 API 的字节限制,通常是因为粘贴的大文件或附件。
+远程 [MCP 服务器](/docs/zh-CN/mcp) 在会话中期拒绝了工具调用上的凭证,通常是因为登录或令牌过期或令牌缺少工具需要的权限。工具调用失败,`/mcp` 将服务器标记为 [需要身份验证](/docs/zh-CN/mcp#authenticate-with-remote-mcp-servers)。
+
+对于您从 Claude Code 登录的服务器,包括 claude.ai 连接器,登录已过期或被撤销:
```text theme={null}
-Request too large (max 30 MB). Double press esc to go back and remove or shrink the attached content.
+MCP server "" needs you to sign in again (run /mcp to re-authenticate)
```
-这是 HTTP 请求的大小限制,与[上下文窗口限制](#prompt-is-too-long)分开。
+运行 `/mcp`,选择服务器,并从其菜单再次登录。
-**应该做什么:**
+对于使用 [`headersHelper`](/docs/zh-CN/mcp#use-dynamic-headers-for-custom-authentication) 脚本配置的服务器,Claude Code 已在显示此之前重新运行 helper 并重试调用一次:
-* 按 Esc 两次并回退到添加超大内容的回合之前
-* 通过路径引用大文件而不是粘贴其内容,以便 Claude 可以分块读取它们
-* 对于图像,请参阅下面的[图像太大](#image-was-too-large)
+```text theme={null}
+MCP server "" rejected the credential from its headersHelper (check the helper and run /mcp to reconnect, or to authenticate if the server also uses OAuth)
+```
-
- Image was too large
-
+检查 helper 返回服务器接受的凭证,然后从 `/mcp` 重新连接,这会再次运行 helper。
-粘贴或附加的图像超过了 API 的大小或尺寸限制。
+对于在其配置中具有静态 `Authorization` 标头的服务器:
```text theme={null}
-Image was too large. Double press esc to go back and try again with a smaller image.
-API Error: 400 ... image dimensions exceed max allowed size
+MCP server "" rejected the Authorization header in its config (update it, then run /mcp to reconnect)
```
-Claude Code 将无法处理的图像替换为文本占位符并重试,因此后续消息成功。在 2.1.142 之前的版本中,粘贴的图像可能会保留在对话中,并在后续的每条消息上重复相同的错误。要在这些版本上恢复,请按 Esc 两次并回退到添加图像的回合之前。
-
-**应该做什么:**
-
-* 在粘贴之前调整图像大小。API 接受单个图像最长边最多 8000 像素的图像,或当许多图像在上下文中时为 2000 像素。
-* 拍摄相关区域的更紧密屏幕截图,而不是整个屏幕
+在配置服务器的位置更新标头值,然后从 `/mcp` 重新连接。
-
- Unable to resize image
-
+在 v2.1.273 之前,过期的登录、`headersHelper` 和 `Authorization` 标头情况都显示 `MCP server "" requires re-authorization (token expired)`。
-Claude Code 无法在将附加图像发送到 API 之前对其进行缩小。
+服务器也可以使用 HTTP 403 `insufficient_scope` 拒绝工具调用,以要求您授权范围,有时是您的令牌已列出的范围。消息命名该范围:
```text theme={null}
-Unable to resize image — image processing is unavailable and dimensions could not be read from the file header. Please convert the image to PNG, JPEG, GIF, or WebP.
-Unable to resize image — dimensions exceed the 2000x2000px limit and image processing failed. Please resize the image to reduce its pixel dimensions.
-Unable to resize image (… raw, … base64). The image exceeds the … API limit and compression failed. Please resize the image manually or use a smaller image.
-Unable to resize image — could not verify image dimensions are within the 2000x2000px API limit.
+MCP server "" needs additional permissions (scope: "") — run /mcp to re-authenticate
```
-Claude Code 通常会自动调整大型图像的大小。这些错误意味着本机图像处理器无法加载或返回错误,因此无法调整图像大小以适应 API 限制。
+运行 `/mcp`,选择服务器,并从其菜单再次进行身份验证。
-**应该做什么:**
+当服务器的配置既不设置 [`oauth.scopes`](/docs/zh-CN/mcp#restrict-oauth-scopes) 也不设置 [`authServerMetadataUrl`](/docs/zh-CN/mcp#override-oauth-metadata-discovery) 时,Claude Code 请求服务器命名的范围。使用任一设置,Claude Code 改为请求该设置的范围。如果您固定了 `oauth.scopes`,在再次进行身份验证之前将缺失的范围添加到该列表。
-* 如果消息要求您转换图像,请将其转换为 PNG、JPEG、GIF 或 WebP,然后再次附加。Claude Code 可以在不使用图像处理器的情况下验证这些格式的尺寸。
-* 如果消息报告尺寸或大小限制,请在附加之前将图像调整大小或重新压缩到该限制以下。
+在 v2.1.274 之前,这种情况显示 `needs you to sign in again` 消息,在 v2.1.273 之前它显示 `requires re-authorization (token expired)`,如其他情况。
-
- PDF errors
+
+ 授权响应中的发行者不匹配
-您附加的 PDF 无法处理。
+在 [MCP OAuth 登录](/docs/zh-CN/mcp#authenticate-with-remote-mcp-servers) 期间,授权服务器重定向回 Claude Code,其中 `iss` 参数不命名 Claude Code 从服务器的 OAuth 元数据期望的发行者。此步骤中的错误发行者是授权服务器混合攻击的样子,因此 Claude Code 失败登录而不是交换授权代码。Claude Code 在浏览器登录后在 `/mcp` 服务器菜单中显示错误:
```text theme={null}
-PDF too large (max 100 pages, 32 MB). Try splitting it or extracting text first.
-PDF is password protected. Try removing protection or extracting text first.
-The PDF file was not valid. Try converting to a different format first.
+Issuer mismatch in authorization response (RFC 9207): expected "https://auth.example.com", received "https://other.example.com"
```
+`expected` 是来自服务器的 OAuth 元数据的发行者,`received` 是重定向携带的 `iss` 值。其重定向不携带 `iss` 参数的登录通过检查,除非服务器的元数据设置 `authorization_response_iss_parameter_supported`,在这种情况下 Claude Code 失败登录。
+
**应该做什么:**
-* 对于超大 PDF,要求 Claude 使用 Read 工具读取页面范围而不是附加整个文件,或使用 `pdftotext` 之类的工具提取文本并通过路径引用输出文件
-* 对于受保护或无效的 PDF,删除密码或从其源应用程序重新导出文件,然后重试
+* 从 `/mcp` 再次尝试登录
+* 如果错误重复,将其报告给服务器操作员。修复是服务器端的:授权服务器必须在 `iss` 参数中返回与在其元数据中宣传的相同发行者
+* 要在修复服务器时连接,使用 [`MCP_SDK_GENERATION=v1`](/docs/zh-CN/env-vars) 启动 Claude Code,其 [运行时](/docs/zh-CN/mcp#mcp-client-runtimes) 不运行此检查。这消除了对混合攻击的保护,因此更喜欢服务器端修复
-