21將您在終端中看到的訊息與下方的部分相符。21將您在終端中看到的訊息與下方的部分相符。
22 22
23| 訊息 | 部分 |23| 訊息 | 部分 |
24| :-------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |24| :------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------ |
25| `API Error: 500 Internal server error` | [Server errors](#api-error-500-internal-server-error) |25| `API Error: 500 Internal server error` | [Server errors](#api-error-500-internal-server-error) |
26| `API Error: Repeated 529 Overloaded errors` | [Server errors](#api-error-repeated-529-overloaded-errors) |26| `API Error: Repeated 529 Overloaded errors` | [Server errors](#api-error-repeated-529-overloaded-errors) |
27| `Request timed out` | [Server errors](#request-timed-out),或如果訊息提及您的網際網路連線,則為 [Network](#unable-to-connect-to-api) |27| `Request timed out` | [Server errors](#request-timed-out),或如果訊息提及您的網際網路連線,則為 [Network](#unable-to-connect-to-api) |
39| `Not logged in · Please run /login` | [Authentication](#not-logged-in) |39| `Not logged in · Please run /login` | [Authentication](#not-logged-in) |
40| `Could not resolve authentication method` | [Authentication](#could-not-resolve-authentication-method) |40| `Could not resolve authentication method` | [Authentication](#could-not-resolve-authentication-method) |
41| `Invalid API key` | [Authentication](#invalid-api-key) |41| `Invalid API key` | [Authentication](#invalid-api-key) |
42| `Your apiKeyHelper script is failing` | [Authentication](#your-apikeyhelper-script-is-failing) |
42| `This organization has been disabled` | [Authentication](#this-organization-has-been-disabled) |43| `This organization has been disabled` | [Authentication](#this-organization-has-been-disabled) |
43| `Your organization has disabled API key authentication` | [Authentication](#your-organization-has-disabled-api-key-authentication) |44| `Your organization has disabled API key authentication` | [Authentication](#your-organization-has-disabled-api-key-authentication) |
44| `Your organization has disabled Claude subscription access` | [Authentication](#your-organization-has-disabled-claude-subscription-access) |45| `Your organization has disabled Claude subscription access` | [Authentication](#your-organization-has-disabled-claude-subscription-access) |
45| `Routines are disabled by your organization's policy` | [Authentication](#routines-are-disabled-by-your-organizations-policy) |46| `Routines are disabled by your organization's policy` | [Authentication](#routines-are-disabled-by-your-organizations-policy) |
46| `Remote Control is only available when using Claude via api.anthropic.com` | [Authentication](#remote-control-requires-the-anthropic-api) |47| `Remote Control is only available when using Claude via api.anthropic.com` | [Authentication](#remote-control-requires-the-anthropic-api) |
47| `OAuth token revoked` / `OAuth token has expired` | [Authentication](#oauth-token-revoked-or-expired) |48| `OAuth token revoked` / `OAuth token has expired` | [Authentication](#oauth-token-revoked-or-expired) |
49| `Login expired · Please run /login` | [Authentication](#login-expired) |
50| `Failed to authenticate: OAuth session expired and could not be refreshed` | [Authentication](#login-expired) |
48| `does not meet scope requirement user:profile` | [Authentication](#oauth-scope-requirement) |51| `does not meet scope requirement user:profile` | [Authentication](#oauth-scope-requirement) |
49| `AWS credentials expired or invalid` | [Authentication](#aws-credentials-expired-or-invalid) |52| `AWS credentials expired or invalid` | [Authentication](#aws-credentials-expired-or-invalid) |
50| `AWS authentication failed` | [Authentication](#aws-authentication-failed) |53| `AWS authentication failed` | [Authentication](#aws-authentication-failed) |
54| `AWS default-chain credential resolve timed out` | [Authentication](#aws-default-chain-credential-resolve-timed-out) |
51| `Unable to connect to API` | [Network](#unable-to-connect-to-api) |55| `Unable to connect to API` | [Network](#unable-to-connect-to-api) |
52| `Waiting for API response · will retry in` | [Automatic retries](#automatic-retries),或如果持續發生,則為 [Network](#unable-to-connect-to-api) |56| `Waiting for API response · will retry in` | [Automatic retries](#automatic-retries),或如果持續發生,則為 [Network](#unable-to-connect-to-api) |
57| `Bedrock streaming response has content-type "..."; expected "application/vnd.amazon.eventstream"` | [Network](#bedrock-streaming-response-has-an-unexpected-content-type) |
53| `SSL certificate verification failed` | [Network](#ssl-certificate-errors) |58| `SSL certificate verification failed` | [Network](#ssl-certificate-errors) |
54| `SSL certificate error (...)` during login or startup | [Network](#ssl-certificate-errors) |59| `SSL certificate error (...)` during login or startup | [Network](#ssl-certificate-errors) |
55| `403` with `x-deny-reason: host_not_allowed` in a cloud or routine session | [Network](#host-not-allowed-in-a-cloud-session) |60| `403` with `x-deny-reason: host_not_allowed` in a cloud or routine session | [Network](#host-not-allowed-in-a-cloud-session) |
76| `--bg and --print conflict` | [Command-line errors](#command-line-errors) |81| `--bg and --print conflict` | [Command-line errors](#command-line-errors) |
77| `Error: --json-schema is not a valid JSON Schema` | [Command-line errors](#command-line-errors) |82| `Error: --json-schema is not a valid JSON Schema` | [Command-line errors](#command-line-errors) |
78| `Could not import <server>: <reason>` | [Command-line errors](#could-not-import-a-server-from-claude-desktop) |83| `Could not import <server>: <reason>` | [Command-line errors](#could-not-import-a-server-from-claude-desktop) |
84| `Error: MCP tool <name> (passed via --permission-prompt-tool) not found` | [Command-line errors](#mcp-permission-prompt-tool-not-found) |
79| `Marketplace "<name>" is registered from an untrusted source` | [Plugin errors](#marketplace-is-registered-from-an-untrusted-source) |85| `Marketplace "<name>" is registered from an untrusted source` | [Plugin errors](#marketplace-is-registered-from-an-untrusted-source) |
86| `references ${user_config.*} in a shell-form command` | [Plugin errors](#plugin-command-references-user-config) |
87| `Monitor "<name>" from plugin <plugin> references ${user_config.*} in its command` | [Plugin errors](#plugin-command-references-user-config) |
88| `headersHelper for MCP server '<name>' references ${user_config.*}` | [Plugin errors](#plugin-command-references-user-config) |
89| `would be spawned with zero tools — refusing` | [Tool errors](#agent-would-be-spawned-with-zero-tools) |
90| `File is covered by a Read deny rule in your permission settings` | [Tool errors](#file-is-covered-by-a-read-deny-rule) |
91| `Can't open MCP settings in a background session` | [Background session errors](#commands-refused-in-a-background-session) |
92| `CLAUDE_CODE_PROCESS_WRAPPER: launcher ...` | [Background session errors](#claude_code_process_wrapper-launcher-errors) |
80| `Ignoring N permissions.allow entries from ... this workspace has not been trusted` | [Configuration warnings](#workspace-has-not-been-trusted) |93| `Ignoring N permissions.allow entries from ... this workspace has not been trusted` | [Configuration warnings](#workspace-has-not-been-trusted) |
81| 回應品質似乎低於平常 | [Response quality](#responses-seem-lower-quality-than-usual) |94| 回應品質似乎低於平常 | [Response quality](#responses-seem-lower-quality-than-usual) |
82 95
86 99
87Claude Code 在向您顯示錯誤之前會重試暫時性失敗。伺服器錯誤、過載回應、請求逾時、臨時 429 節流和中斷的連線都會以指數退避方式重試最多 10 次。{/* min-version: 2.1.198 */}自 v2.1.198 起,這涵蓋在任何可見輸出串流之前在回應中途中斷的連線:Claude Code 使用相同的退避重新發出請求,轉向繼續而不是停止並出現連線錯誤。{/* min-version: 2.1.199 */}自 v2.1.199 起,不帶您計畫配額標頭的臨時 429 節流在您使用 claude.ai 訂閱登入時也會重試;較早的版本僅針對 API 金鑰和 Enterprise 登入重試它們。100Claude Code 在向您顯示錯誤之前會重試暫時性失敗。伺服器錯誤、過載回應、請求逾時、臨時 429 節流和中斷的連線都會以指數退避方式重試最多 10 次。{/* min-version: 2.1.198 */}自 v2.1.198 起,這涵蓋在任何可見輸出串流之前在回應中途中斷的連線:Claude Code 使用相同的退避重新發出請求,轉向繼續而不是停止並出現連線錯誤。{/* min-version: 2.1.199 */}自 v2.1.199 起,不帶您計畫配額標頭的臨時 429 節流在您使用 claude.ai 訂閱登入時也會重試;較早的版本僅針對 API 金鑰和 Enterprise 登入重試它們。
88 101
89有兩個失敗類別不會重試,因為重試無法成功:102有些失敗類別不會重試,因為重試無法成功:
90 103
91* {/* min-version: 2.1.199 */}自 v2.1.199 起,TLS 憑證驗證失敗(例如 TLS 檢查代理、遺失的 `NODE_EXTRA_CA_CERTS` 套件或過期的憑證)在第一次嘗試時失敗,因此修復會立即出現,而不是在完整重試預算之後。請參閱 [SSL certificate errors](#ssl-certificate-errors)。暫時性 TLS 條件(例如握手逾時)仍會重試。104* {/* min-version: 2.1.199 */}自 v2.1.199 起,TLS 憑證驗證失敗(例如 TLS 檢查代理、遺失的 `NODE_EXTRA_CA_CERTS` 套件或過期的憑證)在第一次嘗試時失敗,因此修復會立即出現,而不是在完整重試預算之後。請參閱 [SSL 憑證錯誤](#ssl-certificate-errors)。暫時性 TLS 條件(例如握手逾時)仍會重試。
92* {/* min-version: 2.1.199 */}自 v2.1.199 起,在 Claude 已經串流可見輸出後到達的伺服器錯誤會保留部分回應並附加 [incomplete-response notice](#the-response-above-may-be-incomplete),而不是重試,因為重新執行請求可能會執行相同的工具兩次。較早的版本會捨棄部分輸出並將轉向報告為錯誤。105* {/* min-version: 2.1.199 */}自 v2.1.199 起,在 Claude 已經串流可見輸出後到達的伺服器錯誤會保留部分回應並附加 [不完整回應通知](#the-response-above-may-be-incomplete),而不是重試,因為重新執行請求可能會執行相同的工具兩次。較早的版本會捨棄部分輸出並將轉向報告為錯誤。
106* {/* min-version: 2.1.208 */}[Amazon Bedrock 串流回應具有非預期的內容類型](#bedrock-streaming-response-has-an-unexpected-content-type)在第一次嘗試時失敗,因為重寫回應的閘道或代理會以相同方式重寫重試。需要 Claude Code v2.1.208 或更新版本。
93 107
94重試時,微調器會在錯誤標籤後顯示 `Retrying in Ns · attempt x/y` 倒數計時。標籤命名第一次嘗試的特定原因,以便您可以立即採取行動的失敗:網路已關閉、TLS 握手失敗或您達到速率限制。對於其他錯誤,它最初讀取 `API error`。{/* min-version: 2.1.198 */}自 v2.1.198 起,它會切換到第三次嘗試的特定原因,或在 `CLAUDE_CODE_MAX_RETRIES` 允許少於三次時的最後一次嘗試;較早的版本僅在最後一次嘗試時切換。108重試時,微調器會在錯誤標籤後顯示 `Retrying in Ns · attempt x/y` 倒數計時。標籤命名第一次嘗試的特定原因,以便您可以立即採取行動的失敗:網路已關閉、TLS 握手失敗或您達到速率限制。對於其他錯誤,它最初讀取 `API error`。{/* min-version: 2.1.198 */}自 v2.1.198 起,它會切換到第三次嘗試的特定原因,或在 `CLAUDE_CODE_MAX_RETRIES` 允許少於三次時的最後一次嘗試;較早的版本僅在最後一次嘗試時切換。
95 109
285 299
286Claude Code 會阻止進一步的請求,直到訊息中顯示的重設時間。工作階段和每週限制在所有模型中共享,因此切換模型不會恢復存取。Opus 限制僅適用於 Opus 請求,因此使用 `/model` 切換到另一個模型可讓您繼續工作。300Claude Code 會阻止進一步的請求,直到訊息中顯示的重設時間。工作階段和每週限制在所有模型中共享,因此切換模型不會恢復存取。Opus 限制僅適用於 Opus 請求,因此使用 `/model` 切換到另一個模型可讓您繼續工作。
287 301
302使用額度會同時計入工作階段和每週額度。單一次的大量活動突發,例如大型工作流程扇出,可能會在工作階段視窗重設之前耗盡每週額度。
303
288**該怎麼做:**304**該怎麼做:**
289 305
290* 等待錯誤訊息中顯示的重設時間306* 等待錯誤訊息中顯示的重設時間
430* 如果金鑰來自 [`apiKeyHelper`](/zh-TW/settings#available-settings) 指令碼,請直接執行該指令碼以確認它在 stdout 上列印有效的金鑰446* 如果金鑰來自 [`apiKeyHelper`](/zh-TW/settings#available-settings) 指令碼,請直接執行該指令碼以確認它在 stdout 上列印有效的金鑰
431* 執行 `/status` 以確認 Claude Code 實際使用的認證方式來源447* 執行 `/status` 以確認 Claude Code 實際使用的認證方式來源
432 448
449<h3 id="your-apikeyhelper-script-is-failing">
450 您的 apiKeyHelper 指令碼失敗
451</h3>
452
453在 [`apiKeyHelper`](/zh-TW/settings#available-settings) 設定中設定的命令已結束並出現錯誤、逾時或未在 stdout 上列印任何內容。如果沒有來自指令碼的金鑰,請求會到達 API 並使用預留位置認證方式,API 會以 `401` 拒絕它。
454
455```text theme={null}
456Your apiKeyHelper script is failing · This usually means you need to re-authenticate with your provider · Run /status to see the script's error output
457```
458
459Claude Code 會重新執行指令碼並在顯示此訊息之前最多重試兩次請求,因此失敗會在三次嘗試內出現。{/* min-version: 2.1.208 */}在 v2.1.208 之前,Claude Code 花費完整的[重試預算](#automatic-retries)使用預留位置認證方式重新傳送請求,然後報告通用的 `401` 驗證錯誤而不是指令碼失敗。
460
461執行 `/login` 在此無法幫助:只要設定存在,協助程式的輸出[優先於](/zh-TW/authentication#authentication-precedence)已儲存的登入。
462
463**應該怎麼做:**
464
465* 在您的 shell 中直接執行在 `apiKeyHelper` 中設定的命令以重現失敗
466* 如果命令報告工作階段已過期,請使用您的認證方式提供者重新驗證,例如再次登入您的 SSO 或機密保管庫
467* 修復命令以便它將金鑰列印到 stdout 並以代碼 0 結束。請參閱[使用 apiKeyHelper 輪換認證方式](/zh-TW/llm-gateway-connect#rotate-credentials-with-apikeyhelper)以取得有效的設定。
468* 執行 `/status` 以確認 `apiKeyHelper` 是使用中的認證方式來源。每次命令失敗時,其結束代碼和錯誤輸出會出現在終端中的 `Cloud authentication` 面板中。
469
433<h3 id="this-organization-has-been-disabled">470<h3 id="this-organization-has-been-disabled">
434 此組織已被停用471 此組織已被停用
435</h3>472</h3>
493* 如果您是管理員且看不到啟用存取的選項,請聯絡 [Anthropic 支援](https://support.claude.com)530* 如果您是管理員且看不到啟用存取的選項,請聯絡 [Anthropic 支援](https://support.claude.com)
494 531
495<h3 id="routines-are-disabled-by-your-organizations-policy">532<h3 id="routines-are-disabled-by-your-organizations-policy">
496 您的組織政策已停用例行工作533 例行工作已被您的組織政策停用
497</h3>534</h3>
498 535
499您的 Team 或 Enterprise 組織中的擁有者已在組織層級關閉例行工作。當您嘗試建立或執行例行工作時(包括從 `/schedule` 和 claude.ai/code 上的[例行工作](/zh-TW/routines) UI),會出現此錯誤。536您的 Team 或 Enterprise 組織中的擁有者已在組織層級關閉例行工作。當您嘗試建立或執行例行工作時(包括從 `/schedule` 和 claude.ai/code 上的[例行工作](/zh-TW/routines) UI),會出現此錯誤。
532 569
533您儲存的登入不再有效。撤銷的權杖表示您已在所有地方登出或管理員移除了存取;過期的權杖表示自動重新整理在工作階段中途失敗。570您儲存的登入不再有效。撤銷的權杖表示您已在所有地方登出或管理員移除了存取;過期的權杖表示自動重新整理在工作階段中途失敗。
534 571
572兩個訊息都報告 API 為 Claude Code 傳送的請求傳回的拒絕。當已儲存的登入在失敗的重新整理後已被清除時,您會看到[登入已過期](#login-expired)。
573
535```text theme={null}574```text theme={null}
536OAuth token revoked · Please run /login575OAuth token revoked · Please run /login
537OAuth token has expired · Please run /login576OAuth token has expired · Please run /login
545* 對於跨啟動的重複登入提示,請參閱[疑難排解](/zh-TW/troubleshoot-install#not-logged-in-or-token-expired)中的系統時鐘和 macOS Keychain 檢查584* 對於跨啟動的重複登入提示,請參閱[疑難排解](/zh-TW/troubleshoot-install#not-logged-in-or-token-expired)中的系統時鐘和 macOS Keychain 檢查
546* 對於其他失敗(包括 `403 Forbidden` 和 OAuth 瀏覽器問題),請參閱[登入和驗證](/zh-TW/troubleshoot-install#login-and-authentication)585* 對於其他失敗(包括 `403 Forbidden` 和 OAuth 瀏覽器問題),請參閱[登入和驗證](/zh-TW/troubleshoot-install#login-and-authentication)
547 586
587<h3 id="login-expired">
588 登入已過期
589</h3>
590
591Claude Code 嘗試更新您儲存的 claude.ai 或 Claude Console 登入,OAuth 服務拒絕了儲存的重新整理權杖,因此 Claude Code 清除了儲存的認證方式。之後,每個請求在到達 API 之前都會在本機停止,因為只有 `/login` 可以建立新的認證方式。{/* min-version: 2.1.206 */}在 v2.1.206 之前,Claude Code 無論如何都會傳送請求,並使用環境中剩餘的任何認證方式,然後每個模型都會失敗並出現[所選模型有問題](#theres-an-issue-with-the-selected-model)或 401 而不是登入提示。
592
593```text theme={null}
594Login expired · Please run /login
595```
596
597在[非互動模式](/zh-TW/headless)(`-p`) 和 [Agent SDK](/zh-TW/agent-sdk/overview) 中,訊息如下所示,結構化錯誤代碼為 `authentication_failed`:
598
599```text theme={null}
600Failed to authenticate: OAuth session expired and could not be refreshed
601```
602
603這與[OAuth 權杖已撤銷或已過期](#oauth-token-revoked-or-expired)的狀態不同。這些訊息報告 API 傳回的 401。Claude Code 本身為已失敗更新的登入產生 `Login expired`,因此它不傳送任何請求。
604
605使用 API 金鑰、[`CLAUDE_CODE_OAUTH_TOKEN`](/zh-TW/env-vars) 或第三方提供者驗證的工作階段不使用儲存的登入,永遠不會看到此訊息。
606
607**應該怎麼做:**
608
609* 執行 `/login` 以重新登入。在不登入的情況下重試會在每個請求上顯示相同的訊息。
610* 在非互動模式中,在相同環境中執行 `claude`,完成 `/login`,然後重新執行您的命令。對於無法互動式登入的自動化,請使用 `ANTHROPIC_API_KEY` 進行驗證或[使用 `claude setup-token` 產生長期權杖](/zh-TW/authentication#generate-a-long-lived-token)。
611* 如果登入持續失敗,請參閱[登入和驗證](/zh-TW/troubleshoot-install#login-and-authentication)
612
548<h3 id="oauth-scope-requirement">613<h3 id="oauth-scope-requirement">
549 OAuth 範圍要求614 OAuth 範圍要求
550</h3>615</h3>
603* 如果您的認證方式是最新的,請確認 [IAM 配置](/zh-TW/amazon-bedrock#iam-configuration) 中的 IAM 權限已附加到您使用的身份,且所選模型已為您的帳戶和區域啟用668* 如果您的認證方式是最新的,請確認 [IAM 配置](/zh-TW/amazon-bedrock#iam-configuration) 中的 IAM 權限已附加到您使用的身份,且所選模型已為您的帳戶和區域啟用
604* 執行 `aws sts get-caller-identity` 以確認您的請求使用哪個身份;過時的 `AWS_PROFILE` 或預設設定檔是權限不匹配的常見原因669* 執行 `aws sts get-caller-identity` 以確認您的請求使用哪個身份;過時的 `AWS_PROFILE` 或預設設定檔是權限不匹配的常見原因
605 670
671<h3 id="aws-default-chain-credential-resolve-timed-out">
672 AWS 預設鏈認證方式解析逾時
673</h3>
674
675AWS 預設認證方式提供者鏈在 60 秒內未產生認證方式,因此 Claude Code 停止了解析並使請求失敗。失敗是本機認證方式解析:請求永遠未到達 [Amazon Bedrock](/zh-TW/amazon-bedrock)、[Claude Platform on AWS](/zh-TW/claude-platform-on-aws) 或 [Mantle 端點](/zh-TW/amazon-bedrock#use-the-mantle-endpoint)。Claude Code 在此錯誤出現之前會清除其[認證方式快取](/zh-TW/amazon-bedrock#credential-caching-and-resolution-timeout)並在重複嘗試後重試,因此當您看到它時鏈已在重複嘗試上停滯。
676
677```text theme={null}
678API Error: AWS default-chain credential resolve timed out
679```
680
681常見原因是您的 AWS 設定檔中的 `credential_process` 命令等待它無法接收的輸入,以及容器或 VM 的執行個體中繼資料服務 (IMDS) 永遠不會回答鏈的探測。{/* min-version: 2.1.207 */}在 v2.1.207 之前,停滯的鏈會讓請求無限期等待,而不是以此訊息失敗。
682
683**應該怎麼做:**
684
685* 在相同的 shell 中使用相同的 `AWS_PROFILE` 執行 `aws sts get-caller-identity`。如果它也掛起,請修復設定檔;互動式提示的 `credential_process` 命令是常見原因。
686* 在啟動 Claude Code 之前完成登入步驟,例如 `aws sso login --profile myprofile`,以便鏈從本機 SSO 快取解析而不是等待瀏覽器流程
687* 如果您的鏈執行合法需要超過 60 秒的互動式登入,例如透過 `aws-vault` 等包裝程式的 SSO 搭配 MFA,請使用 [`CLAUDE_CODE_AWS_CHAIN_RESOLVE_TIMEOUT_MS`](/zh-TW/env-vars) 以毫秒為單位提高限制
688
606<h2 id="network-and-connection-errors">689<h2 id="network-and-connection-errors">
607 網路和連線錯誤690 網路和連線錯誤
608</h2>691</h2>
609 692
610這些錯誤表示來自 Claude Code 的網路請求無法到達其目的地。它們通常源自您的本機網路、代理伺服器或防火牆,或雲端環境的網路政策。693這些錯誤表示來自 Claude Code 的網路請求無法到達其目的地,或 Claude Code 和 API 之間的某些東西在回程中改變了回應。它們通常源自您的本機網路、代理伺服器或防火牆,或雲端環境的網路政策。
611 694
612<h3 id="unable-to-connect-to-api">695<h3 id="unable-to-connect-to-api">
613 無法連線到 API696 無法連線到 API
640* 在 macOS 上,已斷開連線或卸載的 VPN 用戶端可能會留下隧道介面或路由規則。檢查 `ifconfig` 是否有過時的 `utun` 介面,並在系統設定中移除 VPN 的網路擴充功能。723* 在 macOS 上,已斷開連線或卸載的 VPN 用戶端可能會留下隧道介面或路由規則。檢查 `ifconfig` 是否有過時的 `utun` 介面,並在系統設定中移除 VPN 的網路擴充功能。
641* Docker Desktop 和類似的容器執行時間可能會攔截出站流量。結束它們並重試以排除此可能性。724* Docker Desktop 和類似的容器執行時間可能會攔截出站流量。結束它們並重試以排除此可能性。
642 725
726<h3 id="bedrock-streaming-response-has-an-unexpected-content-type">
727 Bedrock 串流回應有非預期的 content-type
728</h3>
729
730Claude Code 和 [Amazon Bedrock](/zh-TW/amazon-bedrock) 之間的閘道或代理伺服器正在轉換串流回應本體或其 `Content-Type` 標頭。Amazon Bedrock 將回應串流為 `application/vnd.amazon.eventstream`,而 Claude Code 會拒絕報告不同 content-type 的成功串流回應,而不是解碼它無法讀取的本體。該請求不會重試。
731
732```text theme={null}
733Bedrock 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.
734```
735
736{/* min-version: 2.1.208 */}在 v2.1.208 之前,相同的設定錯誤會在整個回應被緩衝後顯示為 `API Error: Truncated event message received`。
737
738**該怎麼做:**
739
740* 設定閘道以不修改地傳遞 `InvokeModelWithResponseStream` 回應本體及其 `Content-Type` 標頭。將串流重新發出為伺服器傳送事件的中介是常見原因。
741* 如果閘道只重寫標頭並完整傳遞二進位本體,請設定 [`CLAUDE_CODE_DISABLE_BEDROCK_CONTENT_TYPE_GUARD=1`](/zh-TW/env-vars) 以在閘道修復前跳過檢查。請參閱[閘道或代理伺服器後的串流錯誤](/zh-TW/amazon-bedrock#streaming-errors-behind-a-gateway-or-proxy)。
742
643<h3 id="ssl-certificate-errors">743<h3 id="ssl-certificate-errors">
644 SSL 憑證錯誤744 SSL 憑證錯誤
645</h3>745</h3>
859* **Agent SDK**:錯誤文字省略提示,因為模型是以程式設計方式設定的。在 TypeScript 中設定 [`Options` 上的 `model`](/zh-TW/agent-sdk/typescript#options),或在 Python 中設定 [`ClaudeAgentOptions(model=...)`](/zh-TW/agent-sdk/python#claudeagentoptions),並處理結構化的 `model_not_found` 錯誤以呈現您自己的重試或模型選擇器。959* **Agent SDK**:錯誤文字省略提示,因為模型是以程式設計方式設定的。在 TypeScript 中設定 [`Options` 上的 `model`](/zh-TW/agent-sdk/typescript#options),或在 Python 中設定 [`ClaudeAgentOptions(model=...)`](/zh-TW/agent-sdk/python#claudeagentoptions),並處理結構化的 `model_not_found` 錯誤以呈現您自己的重試或模型選擇器。
860* 使用別名(例如 `sonnet` 或 `opus`)而不是完整的版本化 ID。別名解析為維護的預設值,因此不會過時。請參閱[模型配置](/zh-TW/model-config)。960* 使用別名(例如 `sonnet` 或 `opus`)而不是完整的版本化 ID。別名解析為維護的預設值,因此不會過時。請參閱[模型配置](/zh-TW/model-config)。
861* 如果 CLI 中一直出現錯誤的模型,則某處設定了過時的 ID。按[優先順序](/zh-TW/model-config#setting-your-model)檢查:`--model` 標誌、`ANTHROPIC_MODEL` 環境變數,然後是 `.claude/settings.local.json` 中的 `model` 欄位、您專案的 `.claude/settings.json` 和 `~/.claude/settings.json`。移除過時的值,Claude Code 會回退到您的帳戶預設值。961* 如果 CLI 中一直出現錯誤的模型,則某處設定了過時的 ID。按[優先順序](/zh-TW/model-config#setting-your-model)檢查:`--model` 標誌、`ANTHROPIC_MODEL` 環境變數,然後是 `.claude/settings.local.json` 中的 `model` 欄位、您專案的 `.claude/settings.json` 和 `~/.claude/settings.json`。移除過時的值,Claude Code 會回退到您的帳戶預設值。
962* {/* min-version: 2.1.206 */}Claude Code 將過期的 claude.ai 登入報告為[登入已過期](#login-expired),而不是此錯誤。在 v2.1.206 之前,無法再刷新的過期登入在每個模型上都失敗,出現此錯誤;如果您在較舊版本上看到此情況,請執行 `/login`。
862* 對於 Google Cloud 的 Agent Platform 部署,請參閱 [Google Cloud 的 Agent Platform 故障排除](/zh-TW/google-vertex-ai#troubleshooting)。963* 對於 Google Cloud 的 Agent Platform 部署,請參閱 [Google Cloud 的 Agent Platform 故障排除](/zh-TW/google-vertex-ai#troubleshooting)。
863 964
864<h3 id="model-is-not-a-recognized-model-id">965<h3 id="model-is-not-a-recognized-model-id">
1073此訊息需要 Claude Code v2.1.198 或更新版本。您在同一個 `claude` 呼叫中結合了 `--bg` 與 `-p` 或 `--print`。`--bg` 啟動一個[背景工作階段](/zh-TW/agent-view#from-your-shell),您稍後可以使用 `claude agents` 附加到該工作階段,而 `--print` 以[非互動模式](/zh-TW/headless)執行,永遠不會啟動 `claude agents` 附加到的互動工作階段。在 v2.1.198 之前,此組合會無聲地建立一個永遠無法附加的背景工作。1174此訊息需要 Claude Code v2.1.198 或更新版本。您在同一個 `claude` 呼叫中結合了 `--bg` 與 `-p` 或 `--print`。`--bg` 啟動一個[背景工作階段](/zh-TW/agent-view#from-your-shell),您稍後可以使用 `claude agents` 附加到該工作階段,而 `--print` 以[非互動模式](/zh-TW/headless)執行,永遠不會啟動 `claude agents` 附加到的互動工作階段。在 v2.1.198 之前,此組合會無聲地建立一個永遠無法附加的背景工作。
1074 1175
1075```text theme={null}1176```text theme={null}
1177--bg and --print conflict: --print never starts the interactive session that `claude agents` attaches to, so the job would be unattachable. The prompt is the positional — drop --print: `claude --bg '<task>'`.
1076```1178```
1077 1179
1078**該怎麼做:**1180**該怎麼做:**
1085 \--json-schema 值不是有效的 JSON Schema1186 \--json-schema 值不是有效的 JSON Schema
1086</h3>1187</h3>
1087 1188
1088您傳遞給[`--json-schema`](/zh-TW/cli-reference#cli-flags) 的結構描述在[非互動模式](/zh-TW/headless#get-structured-output)中未能通過 JSON Schema 編譯,因此 `claude` 以代碼 1 結束而不是執行提示。在 v2.1.205 之前,無效的結構描述會產生無結構的輸出且沒有錯誤,任何使用 `format` 關鍵字的結構描述都被視為無效。1189您傳遞給[`--json-schema`](/zh-TW/cli-reference#cli-flags)的結構描述在[非互動模式](/zh-TW/headless#get-structured-output)中未能通過 JSON Schema 編譯,所以 `claude` 以代碼 1 結束而不是執行提示。在 v2.1.205 之前,無效的結構描述會產生無結構的輸出且沒有錯誤,任何使用 `format` 關鍵字的結構描述都被視為無效。
1089 1190
1090```text theme={null}1191```text theme={null}
1091Error: --json-schema is not a valid JSON Schema: data/type must be equal to one of the allowed values1192Error: --json-schema is not a valid JSON Schema: data/type must be equal to one of the allowed values
1093 1194
1094第二個冒號之後的文字是驗證器的診斷,並命名失敗的關鍵字或位置。使用 `format` 關鍵字的結構描述(例如 `"format": "email"`)是有效的:Claude Code 接受 `format` 作為註解,不強制執行它。1195第二個冒號之後的文字是驗證器的診斷,並命名失敗的關鍵字或位置。使用 `format` 關鍵字的結構描述(例如 `"format": "email"`)是有效的:Claude Code 接受 `format` 作為註解,不強制執行它。
1095 1196
1096Claude Code 在結構描述編譯之前執行兩項檢查:它拒絕不可解析的 JSON 值,並顯示 `Error: --json-schema is not valid JSON`,以及有效但不是物件的 JSON,並顯示 `Error: --json-schema must be a JSON object`。1197Claude Code 在結構描述編譯之前執行兩項檢查:它拒絕不可解析的 JSON 值並顯示 `Error: --json-schema is not valid JSON`,以及有效但不是物件的 JSON 並顯示 `Error: --json-schema must be a JSON object`。
1097 1198
1098**該怎麼做:**1199**該怎麼做:**
1099 1200
1105 無法從 Claude Desktop 匯入伺服器1206 無法從 Claude Desktop 匯入伺服器
1106</h3>1207</h3>
1107 1208
1108Claude Code 無法新增您在 `claude mcp add-from-claude-desktop` 中選擇的其中一個伺服器。該命令仍會匯入其他選定的伺服器,並為每個無法新增的伺服器列印一行。在 v2.1.205 之前,第一個失敗的伺服器會停止匯入,且所有選定的伺服器都不會被新增。1209Claude Code 無法新增您在 `claude mcp add-from-claude-desktop` 中選擇的其中一個伺服器。該命令仍會匯入其他選定的伺服器,並為每個無法新增的伺服器列印一行。在 v2.1.205 之前,第一個失敗的伺服器會停止匯入,且沒有選定的伺服器被新增。
1109 1210
1110```text theme={null}1211```text theme={null}
1111Could not import my server: Invalid name my server. Names can only contain letters, numbers, hyphens, and underscores.1212Could not import my server: Invalid name my server. Names can only contain letters, numbers, hyphens, and underscores.
1112```1213```
1113 1214
1114伺服器名稱之後的文字是原因。最常見的是名稱檢查:Claude Desktop 允許伺服器名稱中的字元(例如空格和句號),而 `claude mcp` 限制為字母、數字、連字號和底線。其他原因包括未通過驗證的伺服器配置,以及被您組織的 [MCP 政策](/zh-TW/managed-mcp)阻止的伺服器。1215伺服器名稱之後的文字是原因。最常見的是名稱檢查:Claude Desktop 允許伺服器名稱中的字元(例如空格和句號),而 `claude mcp` 限制為字母、數字、連字號和底線。其他原因包括無法通過驗證的伺服器配置,以及被您組織的 [MCP 原則](/zh-TW/managed-mcp)阻止的伺服器。
1115 1216
1116**該怎麼做:**1217**該怎麼做:**
1117 1218
1118* 在 `claude_desktop_config.json` 中重新命名伺服器,僅使用字母、數字、連字號和底線,然後再次執行 `claude mcp add-from-claude-desktop`1219* 在 `claude_desktop_config.json` 中重新命名伺服器,僅使用字母、數字、連字號和底線,然後再次執行 `claude mcp add-from-claude-desktop`
1119* 使用 `claude mcp add` 或 `claude mcp add-json` 在有效名稱下直接新增該伺服器。請參閱[從 Claude Desktop 匯入 MCP 伺服器](/zh-TW/mcp#import-mcp-servers-from-claude-desktop)。1220* 使用 `claude mcp add` 或 `claude mcp add-json` 在有效名稱下直接新增該伺服器。請參閱[從 Claude Desktop 匯入 MCP 伺服器](/zh-TW/mcp#import-mcp-servers-from-claude-desktop)。
1120 1221
1222<h3 id="mcp-permission-prompt-tool-not-found">
1223 找不到 MCP 權限提示工具
1224</h3>
1225
1226您傳遞給 [`--permission-prompt-tool`](/zh-TW/cli-reference#cli-flags) 的工具在執行首次需要權限決定時不在連接的 MCP 工具中,原因可能是其伺服器從未連接,或者沒有連接的伺服器公開該名稱的工具。Claude Code 仍會傳送您的提示:[非互動](/zh-TW/headless)執行在第一個需要批准的工具呼叫時以此錯誤和結束代碼 1 結束,因此即使請求已發出也不會產生答案。在第一個提示之前,Claude Code 會等待最多由 [`MCP_TIMEOUT`](/zh-TW/env-vars) 設定的每個伺服器連接逾時 30 秒,以便該伺服器連接。{/* min-version: 2.1.206 */}在 v2.1.206 之前,啟動不會等待伺服器完成連接,所以啟動緩慢但健康的伺服器也會產生此錯誤。
1227
1228```text theme={null}
1229Error: MCP tool mcp__permissions__approve (passed via --permission-prompt-tool) not found. Available MCP tools: none
1230```
1231
1232`Available MCP tools:` 之後的清單命名了在等待結束時連接的 MCP 工具。
1233
1234**該怎麼做:**
1235
1236* 檢查伺服器是否啟動並保持連接:在同一目錄中執行 `claude mcp list`,並確認伺服器列為已連接
1237* 確認工具名稱與伺服器公開的 `mcp__<server>__<tool>` 名稱相符
1238* 如果伺服器需要超過 30 秒才能啟動,請提高 [`MCP_TIMEOUT`](/zh-TW/env-vars)
1239
1121<h2 id="plugin-errors">1240<h2 id="plugin-errors">
1122 外掛程式錯誤1241 外掛程式錯誤
1123</h2>1242</h2>
1124 1243
1125這些錯誤來自 [外掛程式](/zh-TW/plugins) 和 [marketplace](/zh-TW/plugin-marketplaces) 設定。對於不會產生此頁面上其中一則訊息的外掛程式問題,例如無法載入的 marketplace URL 或已安裝但未出現的外掛程式,請參閱 [外掛程式疑難排解](/zh-TW/discover-plugins#troubleshooting)。1244這些錯誤來自 [外掛程式](/zh-TW/plugins) 和 [市集](/zh-TW/plugin-marketplaces) 設定。對於不會產生此頁面上其中一則訊息的外掛程式問題,例如無法載入的市集 URL 或已安裝但未出現的外掛程式,請參閱 [外掛程式疑難排解](/zh-TW/discover-plugins#troubleshooting)。
1126 1245
1127<h3 id="marketplace-is-registered-from-an-untrusted-source">1246<h3 id="marketplace-is-registered-from-an-untrusted-source">
1128 Marketplace 是從不受信任的來源註冊的1247 市集是從不受信任的來源註冊的
1129</h3>1248</h3>
1130 1249
1131Marketplace 是以 [為官方 Anthropic marketplace 保留的名稱](/zh-TW/plugin-marketplaces#marketplace-schema) 註冊的,但其註冊的來源不是 `anthropics` GitHub 儲存庫。Claude Code 每次載入或重新整理 marketplace 時都會重新檢查保留的名稱,因此 marketplace 和從中安裝的外掛程式會停止載入。在 v2.1.205 之前,名稱只在新增 marketplace 時檢查,因此在其名稱變成保留名稱之前註冊的項目會繼續載入。1250市集是以 [為官方 Anthropic 市集保留的名稱](/zh-TW/plugin-marketplaces#marketplace-schema) 註冊的,但其註冊的來源不是 `anthropics` GitHub 儲存庫。Claude Code 每次載入或重新整理市集時都會重新檢查保留的名稱,因此市集和從中安裝的外掛程式會停止載入。在 v2.1.205 之前,只有在新增市集時才會檢查名稱,因此在名稱變成保留名稱之前註冊的項目會繼續載入。
1132 1251
1133```text theme={null}1252```text theme={null}
1134Marketplace "claude-community" is registered from an untrusted source: The name 'claude-community' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/anthropics/' can use this name. To fix it, remove the marketplace and re-add it from the official source.1253Marketplace "claude-community" is registered from an untrusted source: The name 'claude-community' is reserved for official Anthropic marketplaces. Only repositories from 'github.com/anthropics/' can use this name. To fix it, remove the marketplace and re-add it from the official source.
1136 1255
1137**該怎麼做:**1256**該怎麼做:**
1138 1257
1139* 執行 `claude plugin marketplace remove <name>`,然後從官方 `github.com/anthropics` 儲存庫重新新增 marketplace1258* 執行 `claude plugin marketplace remove <name>`,然後從官方 `github.com/anthropics` 儲存庫重新新增市集
1140* 如果您發佈了在名稱變成保留名稱之前使用該名稱的第三方 marketplace,請重新命名它並要求使用者從您的來源重新新增它1259* 如果您發佈了在名稱變成保留名稱之前使用該名稱的第三方市集,請重新命名它並要求使用者從您的來源重新新增它
1141* 請參閱 [Marketplace schema](/zh-TW/plugin-marketplaces#marketplace-schema) 下的保留名稱清單1260* 請參閱 [市集結構描述](/zh-TW/plugin-marketplaces#marketplace-schema) 下的保留名稱清單
1261
1262<h3 id="plugin-command-references-user-config">
1263 外掛程式命令在 shell 命令中參考 user\_config
1264</h3>
1265
1266外掛程式 hook、[monitor](/zh-TW/plugins-reference#monitors) 或 MCP [`headersHelper`](/zh-TW/mcp#use-dynamic-headers-for-custom-authentication) 命令參考 `${user_config.KEY}` [外掛程式選項](/zh-TW/plugins-reference#user-configuration),而替換後的字串會被傳遞到 shell。設定的值包含 `$(...)` 、反引號或 `;` 會在該處作為程式碼執行,因此 Claude Code 拒絕啟動元件而不是替換該值。檢查在命令範本上執行,因此即使尚未設定任何值,錯誤也會出現。在 v2.1.207 之前,該值被替換到 shell 命令中。
1267
1268措辭取決於哪個介面參考了該選項。shell 形式的 hook 會報告:
1269
1270```text theme={null}
1271Hook from plugin formatter@acme-tools references ${user_config.*} in a shell-form command. The substituted value would be re-parsed by the shell. Use exec form instead — {"command": "<executable>", "args": ["${user_config.KEY}", ...]} — or read $CLAUDE_PLUGIN_OPTION_<KEY> from the hook's environment. Command: ./scripts/notify.sh ${user_config.webhook_url}
1272```
1273
1274monitor 會報告:
1275
1276```text theme={null}
1277Monitor "deploy-status" from plugin deploy-tools references ${user_config.*} in its command. The substituted value would be passed to a shell. Monitor commands cannot safely reference ${user_config.*}; have the monitor script read the value from a config file or prompt instead.
1278```
1279
1280MCP `headersHelper` 會報告:
1281
1282```text theme={null}
1283headersHelper for MCP server 'internal-api' references ${user_config.*}. The substituted value would be passed to a shell; read the value inside the helper script instead (e.g. from an env var set in the server's "env" block).
1284```
1285
1286**該怎麼做:**
1287
1288* 對於 hook,新增 `args` 陣列使其以 [exec 形式](/zh-TW/hooks#exec-form-and-shell-form) 執行,其中每個 `${user_config.KEY}` 變成一個引數,中間沒有 shell。或者移除參考並在指令碼內讀取 `$CLAUDE_PLUGIN_OPTION_<KEY>` 環境變數
1289* 對於 monitor,移除參考並讓 monitor 指令碼從設定檔讀取該值
1290* 對於 `headersHelper`,將 `${user_config.KEY}` 移到伺服器的 `headers` 欄位(不會進行 shell 解析),或在 helper 指令碼內讀取該值
1291
1292<h2 id="tool-errors">
1293 工具錯誤
1294</h2>
1295
1296這些錯誤來自 Claude 的內建工具拒絕輸入。Claude 會自動修正大多數工具錯誤;以下兩個需要您進行變更,因為它們來自您控制的子代理定義或權限規則。
1297
1298<h3 id="agent-would-be-spawned-with-zero-tools">
1299 Agent would be spawned with zero tools
1300</h3>
1301
1302[子代理的 `tools` 清單](/zh-TW/sub-agents#supported-frontmatter-fields)中沒有任何內容解析為工具,因此 Claude Code 拒絕啟動子代理,而不是啟動無法執行操作的代理。該訊息按它們未解析的原因對條目進行分組:未被識別的工具、不適用於子代理的工具,或已識別但與目前工作階段中的任何工具都不匹配。省略 `tools` 欄位永遠不會觸發此拒絕。MCP 伺服器模式(例如 `mcp__github__*`)不在豁免範圍內:當該伺服器沒有連接的工具時,啟動會被拒絕,並在不匹配的群組中顯示該模式。在 v2.1.208 之前,子代理會以零個工具啟動並返回空的或令人困惑的結果。
1303
1304```text theme={null}
1305Agent 'code-reviewer' would be spawned with zero tools — refusing. Its tools list resolved to nothing: unrecognized [Grpe]. Fix the agent's tools frontmatter or pass a different subagent_type.
1306```
1307
1308**應該怎麼做:**
1309
1310* 根據[子代理可用的工具](/zh-TW/sub-agents#available-tools)更正錯誤命名的每個條目
1311* 移除工作階段沒有的工具條目,例如來自未連接伺服器的 MCP 工具
1312* 若要讓子代理擁有父代理的所有工具,請刪除 `tools` 欄位,而不是列出工具
1313
1314<h3 id="file-is-covered-by-a-read-deny-rule">
1315 File is covered by a Read deny rule
1316</h3>
1317
1318Edit 工具在與 [`Read` 拒絕規則](/zh-TW/permissions#read-and-edit)相符的路徑上被呼叫,包括在該路徑建立新檔案。編輯會重寫 Claude 必須能夠讀回的內容,因此呼叫在任何檔案存取之前被拒絕。該規則僅阻止 Edit 工具:Write 和 NotebookEdit 不受 `Read` 拒絕規則涵蓋。在 v2.1.208 之前,只有 `Edit` 拒絕規則會阻止編輯,而 `Read` 拒絕規則單獨不會。
1319
1320```text theme={null}
1321File is covered by a Read deny rule in your permission settings and cannot be edited.
1322```
1323
1324**應該怎麼做:**
1325
1326* 如果 Claude 應該能夠編輯該檔案,請在 `/permissions` 或[設定](/zh-TW/settings#permission-settings)中移除或縮小 `Read` 拒絕規則
1327* 如果檔案必須保持未觸及狀態,請保留該規則並為相同路徑新增 `Edit` 拒絕規則,以便 Write 和 NotebookEdit 工具也被阻止
1328
1329<h2 id="background-session-errors">
1330 背景工作階段錯誤
1331</h2>
1332
1333[背景工作階段](/zh-TW/agent-view)在沒有互動式終端的情況下執行,因此需要終端的命令在那裡的行為會有所不同。這些訊息會出現在背景工作階段的文字記錄中,在代理檢視中或附加後。
1334
1335<h3 id="commands-refused-in-a-background-session">
1336 背景工作階段中被拒絕的命令
1337</h3>
1338
1339在背景工作階段中,開啟互動式對話框的命令會被拒絕,並顯示一條訊息,說明在該處有效的表單或告訴您從常規終端執行命令。`/install-github-app`、`/mcp` 設定清單和 MCP 伺服器選單中的驗證操作都以這種方式被拒絕。在 v2.1.208 之前,它們在背景工作階段內開啟了對話框。
1340{/* max-version: 2.1.208 */}在 v2.1.208 中,`/model` 選擇器也在背景工作階段中被拒絕,`/upgrade` 列印升級 URL 而不是開啟瀏覽器。
1341
1342措辭會說明被拒絕的命令。`/mcp` 設定清單報告:
1343
1344```text theme={null}
1345Can't open MCP settings in a background session — use `/mcp enable|disable|reconnect <server>` to steer, or run /mcp from an interactive terminal to authenticate.
1346```
1347
1348**該怎麼做:**
1349
1350* 使用訊息所說的表單,例如 `/mcp reconnect <server>`、`/mcp enable` 或 `/mcp disable`
1351* 對於登入和授權流程,請從終端中的常規 `claude` 工作階段執行命令
1352
1353<h3 id="claude_code_process_wrapper-launcher-errors">
1354 CLAUDE\_CODE\_PROCESS\_WRAPPER 啟動器錯誤
1355</h3>
1356
1357[`CLAUDE_CODE_PROCESS_WRAPPER`](/zh-TW/corporate-launcher) 已設定,但其值無法使用,因此 Claude Code 拒絕啟動受影響的程序,而不是在沒有啟動器的情況下執行它。配置問題會報告為以變數名稱開頭並說明原因的訊息,例如:
1358
1359```text theme={null}
1360CLAUDE_CODE_PROCESS_WRAPPER: launcher `/opt/corp/launcher` is not an executable regular file
1361```
1362
1363啟動但退出而不用 Claude Code 替換自身的啟動器會導致它啟動的工作階段失敗,該工作階段在代理檢視中的列會報告啟動器 `must exec, not daemonize`,後面跟著啟動器列印的任何內容。由於啟動器而無法啟動或無法到達背景服務的工作階段會將啟動器問題報告為 `Couldn't reach the background service (...)` 內的原因。
1364
1365**該怎麼做:**
1366
1367* 將變數設定為可執行檔的絕對路徑,該路徑以呼叫 `exec "$@"` 結尾。請參閱[啟動器合約](/zh-TW/corporate-launcher#the-launcher-contract)以了解完整合約
1368* 檢查 `/status`,它在其 Self-exec 項目中顯示已解析的啟動命令,並在執行中的背景服務不符合時發出警告,或從 shell 執行 `claude daemon status`
1369* 在修復 [settings](/zh-TW/corporate-launcher#set-up-the-launcher) 的 `env` 區塊中的值後,使用 `claude daemon stop --any` 重新啟動背景服務,以便下一次分派啟動包裝的服務
1142 1370
1143<h2 id="configuration-warnings">1371<h2 id="configuration-warnings">
1144 設定警告1372 設定警告
1150 工作區尚未受信任1378 工作區尚未受信任
1151</h3>1379</h3>
1152 1380
1153Claude Code 在專案的 `.claude/settings.json` 或 `.claude/settings.local.json` 中找到 `permissions.allow` 規則或 `permissions.additionalDirectories` 項目,但未應用它們,因為[來自專案設定的允許規則需要工作區信任](/zh-TW/permissions#project-allow-rules-and-workspace-trust)。訊息中的計數、設定名稱和檔案名稱會根據您的設定而異。`deny` 和 `ask` 規則不受影響。1381Claude Code 在專案的 `.claude/settings.json` 或 `.claude/settings.local.json` 中找到了 `permissions.allow` 規則或 `permissions.additionalDirectories` 項目,但未應用它們,因為[來自專案設定的允許規則需要工作區信任](/zh-TW/permissions#project-allow-rules-and-workspace-trust)。訊息中的計數、設定名稱和檔案名稱會根據您的設定而變化。`deny` 和 `ask` 規則不受影響。
1154 1382
1155```text theme={null}1383```text theme={null}
1156Ignoring 2 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/you/project"].hasTrustDialogAccepted: true in /Users/you/.claude.json.1384Ignoring 2 permissions.allow entries from .claude/settings.local.json: this workspace has not been trusted. Run Claude Code interactively here once and accept the trust dialog, or set projects["/Users/you/project"].hasTrustDialogAccepted: true in /Users/you/.claude.json.
1158 1386
1159**該怎麼做:**1387**該怎麼做:**
1160 1388
1161* 在目錄中執行 `claude` 並接受信任對話框。{/* min-version: 2.1.200 */}即使父目錄已受信任,對話框仍會出現,列出被保留的規則,並讓您拒絕並繼續工作而不使用它們。在 v2.1.200 之前,在該情況下不會出現對話框,因此無法在那裡完成此步驟。1389* 在目錄中執行 `claude` 並接受信任對話框。{/* min-version: 2.1.200 */}即使父目錄已經受信任,對話框仍會出現,列出被保留的規則,並讓您可以拒絕並繼續工作而不使用這些規則。在 v2.1.200 之前,在這種情況下不會出現對話框,因此無法在那裡完成此步驟。
1162* 在[非互動模式](/zh-TW/headless)中使用 `-p` 不會顯示對話框。使用訊息列印的確切 `projects` 金鑰在 `~/.claude.json` 中設定 `hasTrustDialogAccepted` 項目。1390* 在[非互動模式](/zh-TW/headless)中使用 `-p` 時不會顯示對話框。使用訊息列印的確切 `projects` 金鑰在 `~/.claude.json` 中設定 `hasTrustDialogAccepted` 項目。
1163* {/* min-version: 2.1.200 */}如果訊息命名 `.claude/settings.local.json` 且您在 git 儲存庫外或主目錄中啟動 Claude Code,請更新至 v2.1.200 或更新版本。版本 2.1.196 至 2.1.199 在這些工作區中將您自己的 `.claude/settings.local.json` 視為儲存庫提供的。請參閱[專案允許規則和工作區信任](/zh-TW/permissions#project-allow-rules-and-workspace-trust)。1391* {/* min-version: 2.1.200 */}如果訊息命名 `.claude/settings.local.json` 且您在 git 儲存庫外或在主目錄中啟動 Claude Code,請更新至 v2.1.200 或更新版本。版本 2.1.196 至 2.1.199 在這些工作區中將您自己的 `.claude/settings.local.json` 視為儲存庫提供的。{/* min-version: 2.1.207 */}在 v2.1.207 及更新版本上,如果您尚未信任該資料夾,在 git 儲存庫外更新是不夠的:判斷資料夾是否在儲存庫內會執行 git,而 Claude Code 只在您接受信任對話框後才執行該檢查,因此請使用第一步。您的主目錄和任何其他[設定主目錄](/zh-TW/permissions#project-allow-rules-and-workspace-trust)都被豁免,不需要等待對話框。請參閱[專案允許規則和工作區信任](/zh-TW/permissions#project-allow-rules-and-workspace-trust)。
1164 1392
1165<h2 id="responses-seem-lower-quality-than-usual">1393<h2 id="responses-seem-lower-quality-than-usual">
1166 回應品質似乎低於預期1394 回應品質似乎低於預期
1167</h2>1395</h2>
1168 1396
1169如果 Claude 的回答似乎不如預期那樣有能力,但沒有顯示錯誤,原因通常是對話狀態而非模型本身。Claude Code 不會無聲地更改模型版本。它只能在三種特定情況下切換到備用模型:1397如果 Claude 的回答似乎不如您預期的那樣有能力,但沒有顯示錯誤,原因通常是對話狀態而非模型本身。Claude Code 不會無聲地更改模型版本。它只能在三種特定情況下切換到備用模型:
1170 1398
1171* 配置的 [`--fallback-model`](/zh-TW/cli-reference#cli-flags) 在可用性錯誤後接管該輪次,並在文字記錄中顯示通知1399* 配置的 [`--fallback-model`](/zh-TW/cli-reference#cli-flags) 在可用性錯誤後接管該輪次,並在文字記錄中顯示通知
1172* Amazon Bedrock 或 Google Cloud 的 Agent Platform 啟動檢查發現您的預設模型不可用1400* Amazon Bedrock 或 Google Cloud 的 Agent Platform 啟動檢查發現您的預設模型不可用
1173* [自動模型備用](/zh-TW/model-config#automatic-model-fallback)在 Fable 5 上將工作階段移至預設 Opus 模型,並在文字記錄中顯示通知1401* [自動模型備用](/zh-TW/model-config#automatic-model-fallback)在 Fable 5 上將工作階段移至預設 Opus 模型,並在文字記錄中顯示通知
1174 1402
1175下面的模型選擇檢查會捕捉第二和第三種情況;第一種情況會顯示為文字記錄通知而非 `/model` 變更。[模型配置](/zh-TW/model-config)說明每種備用何時適用。1403下面的模型選擇檢查可捕捉第二和第三種情況;第一種情況顯示為文字記錄通知而非 `/model` 變更。[模型配置](/zh-TW/model-config)說明每個備用何時適用。
1176 1404
1177首先檢查這些項目:1405首先檢查這些項目:
1178 1406
1179* **模型選擇**:執行 `/model` 以確認您使用的是預期的模型。先前的 `/model` 選擇或 `ANTHROPIC_MODEL` 環境變數可能會讓您使用比預期更小的模型。1407* **模型選擇**:執行 `/model` 以確認您使用的是預期的模型。先前的 `/model` 選擇或 `ANTHROPIC_MODEL` 環境變數可能使您使用的模型比預期的要小。
1180* **努力程度**:執行 `/effort` 以檢查目前的推理程度,並針對困難的除錯或設計工作提高它。預設值因模型而異,因此在假設您低於最大值之前請先檢查。請參閱[調整努力程度](/zh-TW/model-config#adjust-effort-level)以了解各模型的預設值和 `ultrathink` 快捷方式。1408* **努力程度**:執行 `/effort` 以檢查目前的推理級別,並針對困難的除錯或設計工作提高它。預設值因模型而異,因此在假設您低於最大值之前請先檢查。請參閱[調整努力程度](/zh-TW/model-config#adjust-effort-level)以了解每個模型的預設值和 `ultrathink` 快捷方式。
1181* **上下文壓力**:執行 `/context` 以查看視窗的滿度。如果接近容量,請在自然中斷點執行 `/compact` 或執行 `/clear` 以重新開始。請參閱[探索上下文視窗](/zh-TW/context-window)以了解自動壓縮如何影響較早的輪次。1409* **上下文壓力**:執行 `/context` 以查看視窗的滿度。如果接近容量,請在自然中斷點執行 `/compact` 或執行 `/clear` 以重新開始。請參閱[探索上下文視窗](/zh-TW/context-window)以了解自動壓縮如何影響較早的輪次。
1182* **過時的指示**:大型或過時的 `CLAUDE.md` 檔案和 MCP 工具定義會消耗上下文,並可能引導回應。{/* min-version: 2.1.205 */}`/doctor` 檢查會標記超大的記憶體檔案和未使用的擴充功能,`/context` 會顯示 MCP 工具的權杖使用情況。在 v2.1.205 之前,`/doctor` 會開啟診斷畫面,標記超大的記憶體檔案和子代理定義。1410* **過時的指示**:大型或過時的 `CLAUDE.md` 檔案和 MCP 工具定義會消耗上下文,並可能引導回應。{/* min-version: 2.1.205 */}`/doctor` 檢查會標記超大記憶體檔案和未使用的擴充功能,而 `/context` 會顯示 MCP 工具令牌使用情況。在 v2.1.205 之前,`/doctor` 開啟診斷畫面,標記超大記憶體檔案和子代理定義。
1183 1411
1184當回應出錯時,通常比用更正回覆更有效的做法是回溯。按 Esc 兩次或執行 `/rewind` 以回到不良輪次之前,然後用更具體的內容重新表述提示。在執行緒中更正會將錯誤的嘗試保留在上下文中,這可能會將後續答案錨定到它。請參閱[檢查點](/zh-TW/checkpointing)。1412當回應出錯時,回溯通常比用更正回覆效果更好。按 Esc 兩次或執行 `/rewind` 以回到不良輪次之前,然後用更具體的內容重新表述提示。在執行緒中更正會將錯誤的嘗試保留在上下文中,這可能會將後續答案錨定到它。請參閱[檢查點](/zh-TW/checkpointing)。
1185 1413
1186如果在檢查上述項目後品質仍然似乎不對,請執行 `/feedback` 並描述您預期的內容與實際得到的內容。以這種方式提交的回饋包括對話文字記錄,這是 Anthropic 診斷真實迴歸的最快方式。如果 `/feedback` 在您的環境中不可用,請參閱[報告錯誤](#report-an-error)。1414如果在檢查上述項目後品質仍然似乎不對,請執行 `/feedback` 並描述您預期的內容與您得到的內容。以這種方式提交的回饋包括對話文字記錄,這是 Anthropic 診斷真實回歸的最快方式。如果 `/feedback` 在您的環境中不可用,請參閱[報告錯誤](#report-an-error)。
1187 1415
1188{/* min-version: 2.1.201 */}如果 Sonnet 5 拒絕請求並在 Claude Code v2.1.200 或更早版本上引用可疑的提示注入,請執行 `claude update` 以取得 v2.1.201 修正。1416如果 Claude 警告懷疑提示注入,或因懷疑注入而拒絕請求,而警告命名的文字是 Claude Code 自動添加到對話中的上下文而非檔案或網路內容,請執行 `claude update` 並重試。如果更新後警告重複出現,請[報告它](#report-an-error)而不是將標記的內容貼回提示中。{/* min-version: 2.1.201 */}在 v2.1.201 之前,Sonnet 5 以相同方式拒絕了某些請求。
1189 1417
1190<h2 id="report-an-error">1418<h2 id="report-an-error">
1191 回報錯誤1419 回報錯誤
1199 1427
1200如果此處未列出錯誤或建議的修正方法無法幫助:1428如果此處未列出錯誤或建議的修正方法無法幫助:
1201 1429
1202* 在 Claude Code 內執行 `/feedback` 以將文字記錄和說明傳送給 Anthropic。該命令也提供開啟預先填入的 GitHub issue 的選項。在 Amazon Bedrock、Google Cloud 的 Agent Platform、Microsoft Foundry 和其他第三方提供者上,`/feedback` 會儲存本機封存,您可以將其傳送給您的 Anthropic 帳戶代表。1430* 在 Claude Code 內執行 `/feedback` 以將文字記錄和說明傳送給 Anthropic。該命令也提供開啟預先填入的 GitHub issue 的選項。傳送給 Anthropic 需要[驗證](/zh-TW/authentication)。在 Amazon Bedrock、Google Cloud 的 Agent Platform、Microsoft Foundry 和其他第三方提供者上,或當未設定 Anthropic 認證時,`/feedback` 會儲存本機封存,您可以改為傳送給您的 Anthropic 帳戶代表。
1203* 從您的 shell 執行 `claude doctor` 以進行安裝的唯讀診斷,或在 Claude Code 內執行 `/doctor` 檢查以尋找並修正設定問題1431* 從您的 shell 執行 `claude doctor` 以進行安裝的唯讀診斷,或在 Claude Code 內執行 `/doctor` 檢查以尋找並修正設定問題
1204* 檢查 [status.claude.com](https://status.claude.com) 以了解活躍的事件1432* 檢查 [status.claude.com](https://status.claude.com) 以了解活躍的事件
1205* 在 GitHub 上搜尋[現有 issue](https://github.com/anthropics/claude-code/issues)1433* 在 GitHub 上搜尋[現有 issue](https://github.com/anthropics/claude-code/issues)