modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -127,7 +127,7 @@ That value is enough for a screenshot, and for a Read of a whole PDF up to Read’s 20 MB limit. If the error comes back, for example on an Edit of a very large file, set a higher value. Any change a tool already made stays in place, and the tool call whose message was too long may have made one. To pick up the work that stopped: 1. If you hold a `ClaudeSDKClient` open, call `disconnect()`. The client receives no more messages after this error, but Claude Code keeps running and can still make changes. - 2. Start a new `query()` or `ClaudeSDKClient` with the larger limit and [`continue_conversation=True`](</docs/en/agent-sdk/sessions#continue-resume-and-fork>), which picks the most recent session in the working directory. To pick a specific session, set `resume` to `data["session_id"]` from the init [`SystemMessage`](</docs/en/agent-sdk/python#systemmessage>). + 2. Start a new `query()` or `ClaudeSDKClient` with the larger limit, and set `resume` to `data["session_id"]` from the init [`SystemMessage`](</docs/en/agent-sdk/python#systemmessage>). In an app that serves several users, keep each user’s session ID and resume with it, and start a new session for a user whose ID you didn’t keep. If your app runs one conversation at a time and you didn’t keep the ID, set [`continue_conversation=True`](</docs/en/agent-sdk/sessions#continue-resume-and-fork>) instead to resume the most recent session in the working directory. ## Streaming input
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -13,6 +13,7 @@ `CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `CLIJSONDecodeError`, `structured_output` is `None`| CLI startup, CLI process exit, Large tool calls and results, and Structured outputs on this page `Operation aborted`, `Claude Code process aborted by user`, `Prompt stream failed; closing stdin`, or a Python `query()` loop that stops, with no exception, before all your messages are answered| Streaming input on this page `Image could not be processed`| Image could not be processed on this page +`option can't be sent to Claude Code` in TypeScript| [`Options`](</docs/en/agent-sdk/typescript#options>): fix the option the message names ## CLI startup
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,4 +1,4 @@ -This page covers Agent SDK errors in CLI startup, CLI process exit, large tool calls and results, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom: +This page covers Agent SDK errors in CLI startup, CLI process exit, large tool calls and results, streaming input, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. Look up your symptom in this table to find the section or page that covers it: Symptom| Go to ---|--- @@ -11,6 +11,8 @@ An agent that works on your machine fails in a deployed service or container| [Troubleshoot deployment failures](</docs/en/agent-sdk/hosting#troubleshoot-deployment-failures>) `Not logged in`, `Invalid API key`, `API Error`, `429`, `There's an issue with the selected model`| [Error reference](</docs/en/errors#find-your-error>) `CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `CLIJSONDecodeError`, `structured_output` is `None`| CLI startup, CLI process exit, Large tool calls and results, and Structured outputs on this page +`Operation aborted`, `Claude Code process aborted by user`, `Prompt stream failed; closing stdin`, or a Python `query()` loop that stops, with no exception, before all your messages are answered| Streaming input on this page +`Image could not be processed`| Image could not be processed on this page ## CLI startup @@ -126,6 +128,36 @@ 1. If you hold a `ClaudeSDKClient` open, call `disconnect()`. The client receives no more messages after this error, but Claude Code keeps running and can still make changes. 2. Start a new `query()` or `ClaudeSDKClient` with the larger limit and [`continue_conversation=True`](</docs/en/agent-sdk/sessions#continue-resume-and-fork>), which picks the most recent session in the working directory. To pick a specific session, set `resume` to `data["session_id"]` from the init [`SystemMessage`](</docs/en/agent-sdk/python#systemmessage>). +## Streaming input + +### Operation aborted + +In TypeScript, your `for await` loop over `query()` throws one of these messages as an `AbortError`. Either one means the query was aborted: + + Operation aborted + Claude Code process aborted by user + +Check for these causes: + + * **Your code aborted the query** : if your code calls `abort()` on the `AbortController` you passed as the [`abortController`](</docs/en/agent-sdk/typescript#options>) option, the loop throws one of these errors. If you didn’t intend the abort, check where your code calls `abort()`. + * **Your async generator threw** : the error doesn’t include your generator’s own error message. To see that message, wrap the generator’s body in `try`/`catch`, log the caught error, and rethrow it. Then fix the error you logged. + +### Prompt stream failed; closing stdin + +In Python, when the async generator you passed to the `query()` function raises an exception, your `async for` loop over `query()` ends with no exception. The SDK logs this line at `ERROR` level. If you haven’t configured logging, Python prints the line to stderr: + + Prompt stream failed; closing stdin: <your exception's message> + +To see the exception’s traceback, wrap the generator’s body in `try`/`except`. Log the exception with its traceback and raise it again. Then fix the exception you logged. + +### Image could not be processed + +When an image block in your message has no `source` object, no error reaches your code. Claude receives this text note in place of the image: + + [Image could not be processed: image block has no source object] + +Claude answers without the image. Check that each image block has a `source` object, as in [Send a follow-up with an image](</docs/en/agent-sdk/streaming-vs-single-mode#send-a-follow-up-with-an-image>). + ## Structured outputs ### structured_output is None but the result says success
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,4 +1,4 @@ -This page covers Agent SDK errors in CLI startup, CLI process exit, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom: +This page covers Agent SDK errors in CLI startup, CLI process exit, large tool calls and results, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom: Symptom| Go to ---|--- @@ -10,7 +10,7 @@ Hook not firing, matcher not filtering as expected, hook timeout, tool blocked unexpectedly, modified input not applied, session hooks not available in Python, subagent permission prompts multiplying, recursive hook loops with subagents, `systemMessage` not appearing in output| [Fix common issues](</docs/en/agent-sdk/hooks#fix-common-issues>) on the hooks page An agent that works on your machine fails in a deployed service or container| [Troubleshoot deployment failures](</docs/en/agent-sdk/hosting#troubleshoot-deployment-failures>) `Not logged in`, `Invalid API key`, `API Error`, `429`, `There's an issue with the selected model`| [Error reference](</docs/en/errors#find-your-error>) -`CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `structured_output` is `None`| CLI startup, CLI process exit, and Structured outputs on this page +`CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `CLIJSONDecodeError`, `structured_output` is `None`| CLI startup, CLI process exit, Large tool calls and results, and Structured outputs on this page ## CLI startup @@ -104,6 +104,28 @@ The text after the colon is the CLI’s report of what went wrong, so start there rather than with the exit itself. Python raises this as a [`ResultError`](</docs/en/agent-sdk/python#resulterror>), whose `data` attribute carries the full error result. TypeScript rejects the message loop with a plain `Error` carrying the same message shape. +## Large tool calls and results + +### CLIJSONDecodeError: JSON message exceeded maximum buffer size + +The Python SDK raises this error when one message from Claude Code is longer than the [`max_buffer_size`](</docs/en/agent-sdk/python#claudeagentoptions>) option, which defaults to 1,048,576 characters. The error calls them bytes: + + Failed to decode JSON: JSON message exceeded maximum buffer size of 1048576 bytes... + +For example, PDFs, screenshots, and text files can produce messages that reach that limit: + + * **PDFs and screenshots** : when Claude reads a whole PDF of about 393 KB or more with the Read tool, the tool result can reach the limit, because it holds the file’s base64 twice. A tool result with a screenshot, from Read or an MCP tool, holds the base64 twice too. + * **Text files** : messages from the Edit and Write tools can reach the limit on a file well under 1 MB, depending on how much of the file changes. + +To stop the error, set a larger limit in `ClaudeAgentOptions`: + + options = ClaudeAgentOptions(max_buffer_size=64 * 1024 * 1024) + +That value is enough for a screenshot, and for a Read of a whole PDF up to Read’s 20 MB limit. If the error comes back, for example on an Edit of a very large file, set a higher value. Any change a tool already made stays in place, and the tool call whose message was too long may have made one. To pick up the work that stopped: + + 1. If you hold a `ClaudeSDKClient` open, call `disconnect()`. The client receives no more messages after this error, but Claude Code keeps running and can still make changes. + 2. Start a new `query()` or `ClaudeSDKClient` with the larger limit and [`continue_conversation=True`](</docs/en/agent-sdk/sessions#continue-resume-and-fork>), which picks the most recent session in the working directory. To pick a specific session, set `resume` to `data["session_id"]` from the init [`SystemMessage`](</docs/en/agent-sdk/python#systemmessage>). + ## Structured outputs ### structured_output is None but the result says success
modified
Show diff (140 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -12,17 +12,9 @@ `Not logged in`, `Invalid API key`, `API Error`, `429`, `There's an issue with the selected model`| [Error reference](</docs/en/errors#find-your-error>) `CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `structured_output` is `None`| CLI startup, CLI process exit, and Structured outputs on this page -## +## CLI startup -​ - -CLI startup - -### - -​ - -CLINotFoundError: Claude Code not found +### CLINotFoundError: Claude Code not found The Python SDK launches the Claude Code CLI as a subprocess. When it can’t find a `claude` executable, connecting fails with a `CLINotFoundError`: @@ -39,11 +31,7 @@ * `Native CLI binary for <platform>-<arch> not found`: the bundled platform package is missing, most often because the install skipped optional dependencies. Reinstall `@anthropic-ai/claude-agent-sdk` without skipping optional dependencies, or point `pathToClaudeCodeExecutable` at a [native install](</docs/en/setup#install-claude-code>). In a single-file executable built with `bun build --compile`, the same message has a different cause and fix. See [Compile to a single executable](</docs/en/agent-sdk/typescript#compile-to-a-single-executable>). * `Claude Code native binary not found at <path>` or `Claude Code executable not found at <path>. Is options.pathToClaudeCodeExecutable set?`: the file at the resolved path is missing, or the process can’t access it. Confirm the file exists at that path and that the process can access it. -### - -​ - -CLIConnectionError: Refusing to execute batch script +### CLIConnectionError: Refusing to execute batch script On Windows, connecting fails with a `CLIConnectionError` when the CLI path the Python SDK uses is a `.bat` or `.cmd` batch script, including the `claude.cmd` shim that an npm install creates: @@ -62,11 +50,7 @@ Before `claude-agent-sdk` 0.2.124, the Python SDK spawned batch scripts through `cmd.exe` without this check. -### - -​ - -CLIConnectionError: Failed to start Claude Code +### CLIConnectionError: Failed to start Claude Code The SDK found a file at the resolved path but couldn’t launch it. Python raises these failures as a `CLIConnectionError`. TypeScript rejects the message iteration with an error carrying no SDK class. The table below maps each message to what it tells you. Match the message you see: @@ -83,11 +67,7 @@ * If you don’t need a custom path, remove `cli_path` in Python or `pathToClaudeCodeExecutable` in TypeScript so the SDK finds a CLI on its own, preferring its bundled copy. * When the failing binary is the SDK’s bundled copy in a container image, reinstall the SDK during the image build so the bundled binary matches the container’s platform, or rebuild the image for the architecture it runs on. The usual cause is a binary that doesn’t match the container’s architecture or libc, or one that lost its execute permission in the image build. -### - -​ - -CLIConnectionError: Not connected +### CLIConnectionError: Not connected Calling a `ClaudeSDKClient` method in Python before the client has connected, or after it has disconnected, raises a `CLIConnectionError` with this message: @@ -95,19 +75,11 @@ Do what the message says. Either call `await client.connect()` before any other client method, or open the client with `async with ClaudeSDKClient() as client:`, which connects on entry. -## - -​ - -CLI process exit +## CLI process exit The entries in this section mean the Claude Code process ended while your application was using it. Which error you see depends on the SDK language and on whether the CLI reported an error result before it exited. -### - -​ - -ProcessError: Command failed with exit code +### ProcessError: Command failed with exit code The Python SDK raises a `ProcessError` when the Claude Code process exits with a nonzero code: @@ -116,11 +88,7 @@ The message states the exit code twice, and the `Error output` line is fixed text rather than your process’s error output. The same fixed text fills the exception’s `stderr` attribute. The exception’s `exit_code` attribute carries the code. To capture what the CLI actually wrote to stderr, pass a `stderr` callback in `ClaudeAgentOptions` and log what it receives. A bare `ProcessError` means the CLI exited without reporting an error result. When the CLI did report one, the SDK raises [`ResultError`](</docs/en/agent-sdk/python#resulterror>) instead, covered in Claude Code returned an error result. `ResultError` subclasses `ProcessError`, so `except ProcessError` catches both. To handle them differently, put the `except ResultError` clause first. Before `claude-agent-sdk` 0.2.140, the Python SDK raised error-result exits as a plain `Exception` rather than a `ResultError`. -### - -​ - -Claude Code process exited with code N +### Claude Code process exited with code N IDE wrappers print this message too, and the [error reference](</docs/en/errors#claude-code-process-exited-with-code-n>) covers it for VS Code and other launchers. This entry covers what your TypeScript SDK code receives. The SDK surfaces a nonzero CLI exit as a plain `Error` that rejects the `for await` loop over `query()`’s messages. There’s no SDK error class to catch, so wrap the loop in `try`/`catch` and match on the message: @@ -128,11 +96,7 @@ When the CLI wrote to stderr, the message ends with the tail of it. To capture the full stream, pass a `stderr` callback in the query options. A process killed by a signal reports `Claude Code process terminated by signal <name>` in the same form. -### - -​ - -Claude Code returned an error result +### Claude Code returned an error result Both SDKs replace the process-exit error with this message when the CLI reported an error result before exiting: @@ -140,27 +104,15 @@ The text after the colon is the CLI’s report of what went wrong, so start there rather than with the exit itself. Python raises this as a [`ResultError`](</docs/en/agent-sdk/python#resulterror>), whose `data` attribute carries the full error result. TypeScript rejects the message loop with a plain `Error` carrying the same message shape. -## +## Structured outputs -​ - -Structured outputs - -### - -​ - -structured_output is None but the result says success +### structured_output is None but the result says success A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. Treat this result as a failure in application code. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. Then check for these causes: * **A request that Claude declined** : to detect this case in your code, check the result message’s `stop_reason` for `"refusal"`. For what to try next, see [Usage Policy refusal](</docs/en/errors#usage-policy-refusal>). * **A schema no output can satisfy** : for example, a string whose `minLength` is greater than its `maxLength`. If `structured_output` is missing repeatedly with a schema you believe is correct, look for constraints that contradict each other. If you find none, simplify the schema until outputs validate, then reintroduce your constraints one at a time. -## - -​ - -Report a new issue +## Report a new issue If your error isn’t covered here, check the open issues or file a new one in the SDK repositories: [claude-agent-sdk-typescript](<https://github.com/anthropics/claude-agent-sdk-typescript/issues>) or [claude-agent-sdk-python](<https://github.com/anthropics/claude-agent-sdk-python/issues>). Include the full error text and your SDK version.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -152,7 +152,7 @@ structured_output is None but the result says success -A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. Then check for these causes: +A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. Treat this result as a failure in application code. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. Then check for these causes: * **A request that Claude declined** : to detect this case in your code, check the result message’s `stop_reason` for `"refusal"`. For what to try next, see [Usage Policy refusal](</docs/en/errors#usage-policy-refusal>). * **A schema no output can satisfy** : for example, a string whose `minLength` is greater than its `maxLength`. If `structured_output` is missing repeatedly with a schema you believe is correct, look for constraints that contradict each other. If you find none, simplify the schema until outputs validate, then reintroduce your constraints one at a time.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -152,7 +152,10 @@ structured_output is None but the result says success -A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. One way to hit this is a schema no output can satisfy, for example conflicting length constraints. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. If it happens repeatedly with a schema you believe is correct, verify the schema is satisfiable, then simplify it until outputs validate, and reintroduce constraints one at a time. +A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. Then check for these causes: + + * **A request that Claude declined** : to detect this case in your code, check the result message’s `stop_reason` for `"refusal"`. For what to try next, see [Usage Policy refusal](</docs/en/errors#usage-policy-refusal>). + * **A schema no output can satisfy** : for example, a string whose `minLength` is greater than its `maxLength`. If `structured_output` is missing repeatedly with a schema you believe is correct, look for constraints that contradict each other. If you find none, simplify the schema until outputs validate, then reintroduce your constraints one at a time. ##
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -3,7 +3,7 @@ Symptom| Go to ---|--- Skills not found, a skill not being used, `Invalid skill name` error| [Skills troubleshooting](</docs/en/agent-sdk/skills#troubleshooting>) -MCP server shows `failed` status, tools not being called, connection timeouts, tool output that exceeds the maximum allowed tokens| [MCP troubleshooting](</docs/en/agent-sdk/mcp#troubleshooting>) +MCP server shows `failed` status, tools not being called, a tool missing from an SDK MCP server, connection timeouts, tool output that exceeds the maximum allowed tokens| [MCP troubleshooting](</docs/en/agent-sdk/mcp#troubleshooting>) Plugin not loading, plugin skills not appearing| [Plugins troubleshooting](</docs/en/agent-sdk/plugins#troubleshooting>) Claude not delegating to subagents, filesystem-based agents not loading| [Subagents troubleshooting](</docs/en/agent-sdk/subagents#troubleshooting>) Checkpointing options not recognized, user messages without UUIDs, `No file checkpoint found`, `File rewinding is not enabled`, `ProcessTransport is not ready for writing`| [File checkpointing troubleshooting](</docs/en/agent-sdk/file-checkpointing#troubleshooting>)
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -152,7 +152,7 @@ structured_output is None but the result says success -A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. One way to hit this is a schema no output can satisfy, for example conflicting length constraints. The run ends without a validation error, and the only signal is the missing `structured_output`. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. If it happens repeatedly with a schema you believe is correct, verify the schema is satisfiable, then simplify it until outputs validate, and reintroduce constraints one at a time. +A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. One way to hit this is a schema no output can satisfy, for example conflicting length constraints. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. If it happens repeatedly with a schema you believe is correct, verify the schema is satisfiable, then simplify it until outputs validate, and reintroduce constraints one at a time. ##
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,4 +1,16 @@ -Entries on this page are keyed to the error you see. Each names the cause and what to do. +This page covers Agent SDK errors in CLI startup, CLI process exit, and structured outputs. Entries on this page are keyed to the error you see. Each entry names the cause and what to do. Symptoms tied to a feature, such as a hook not firing or a skill not being used, have a troubleshooting section on that feature’s page. The table names the section or page that covers each symptom: + +Symptom| Go to +---|--- +Skills not found, a skill not being used, `Invalid skill name` error| [Skills troubleshooting](</docs/en/agent-sdk/skills#troubleshooting>) +MCP server shows `failed` status, tools not being called, connection timeouts, tool output that exceeds the maximum allowed tokens| [MCP troubleshooting](</docs/en/agent-sdk/mcp#troubleshooting>) +Plugin not loading, plugin skills not appearing| [Plugins troubleshooting](</docs/en/agent-sdk/plugins#troubleshooting>) +Claude not delegating to subagents, filesystem-based agents not loading| [Subagents troubleshooting](</docs/en/agent-sdk/subagents#troubleshooting>) +Checkpointing options not recognized, user messages without UUIDs, `No file checkpoint found`, `File rewinding is not enabled`, `ProcessTransport is not ready for writing`| [File checkpointing troubleshooting](</docs/en/agent-sdk/file-checkpointing#troubleshooting>) +Hook not firing, matcher not filtering as expected, hook timeout, tool blocked unexpectedly, modified input not applied, session hooks not available in Python, subagent permission prompts multiplying, recursive hook loops with subagents, `systemMessage` not appearing in output| [Fix common issues](</docs/en/agent-sdk/hooks#fix-common-issues>) on the hooks page +An agent that works on your machine fails in a deployed service or container| [Troubleshoot deployment failures](</docs/en/agent-sdk/hosting#troubleshoot-deployment-failures>) +`Not logged in`, `Invalid API key`, `API Error`, `429`, `There's an issue with the selected model`| [Error reference](</docs/en/errors#find-your-error>) +`CLINotFoundError`, `CLIConnectionError`, `ProcessError`, `Claude Code process exited with code N`, `Claude Code returned an error result`, `structured_output` is `None`| CLI startup, CLI process exit, and Structured outputs on this page ##
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -22,6 +22,11 @@ * If you set `cli_path`, confirm the file exists and is the `claude` executable. * If you rely on `PATH` resolution, confirm `claude --version` works in the same environment your application runs in. Processes you launch outside your shell, such as from an IDE or a service manager, often run with a different `PATH`. +The TypeScript SDK looks for the CLI in its bundled platform package and the path you set in `pathToClaudeCodeExecutable`. Match the message you see: + + * `Native CLI binary for <platform>-<arch> not found`: the bundled platform package is missing, most often because the install skipped optional dependencies. Reinstall `@anthropic-ai/claude-agent-sdk` without skipping optional dependencies, or point `pathToClaudeCodeExecutable` at a [native install](</docs/en/setup#install-claude-code>). In a single-file executable built with `bun build --compile`, the same message has a different cause and fix. See [Compile to a single executable](</docs/en/agent-sdk/typescript#compile-to-a-single-executable>). + * `Claude Code native binary not found at <path>` or `Claude Code executable not found at <path>. Is options.pathToClaudeCodeExecutable set?`: the file at the resolved path is missing, or the process can’t access it. Confirm the file exists at that path and that the process can access it. + ### ​ @@ -45,6 +50,84 @@ Before `claude-agent-sdk` 0.2.124, the Python SDK spawned batch scripts through `cmd.exe` without this check. +### + +​ + +CLIConnectionError: Failed to start Claude Code + +The SDK found a file at the resolved path but couldn’t launch it. Python raises these failures as a `CLIConnectionError`. TypeScript rejects the message iteration with an error carrying no SDK class. The table below maps each message to what it tells you. Match the message you see: + +Message| SDK| What it tells you +---|---|--- +`Failed to start Claude Code: <detail>`| Python| The rest of the message is the operating system’s own error +`Claude Code executable at <path> exists but failed to launch`| TypeScript| The script at the configured path can’t run +`Claude Code native binary at <path> exists but failed to launch`| TypeScript| The binary can’t run, with a libc suggestion appended to the message +`Failed to spawn Claude Code process: <detail>`| TypeScript| Any other launch failure + +In both SDKs, the usual cause is a resolved path that points at something that can’t run, such as a text file, a directory, or a file without execute permission. Read the native-binary message’s libc suggestion as one possible cause. To fix it in either SDK: + + * Confirm the configured path points at the `claude` executable itself and that the file has execute permission. + * If you don’t need a custom path, remove `cli_path` in Python or `pathToClaudeCodeExecutable` in TypeScript so the SDK finds a CLI on its own, preferring its bundled copy. + * When the failing binary is the SDK’s bundled copy in a container image, reinstall the SDK during the image build so the bundled binary matches the container’s platform, or rebuild the image for the architecture it runs on. The usual cause is a binary that doesn’t match the container’s architecture or libc, or one that lost its execute permission in the image build. + +### + +​ + +CLIConnectionError: Not connected + +Calling a `ClaudeSDKClient` method in Python before the client has connected, or after it has disconnected, raises a `CLIConnectionError` with this message: + + Not connected. Call connect() first. + +Do what the message says. Either call `await client.connect()` before any other client method, or open the client with `async with ClaudeSDKClient() as client:`, which connects on entry. + +## + +​ + +CLI process exit + +The entries in this section mean the Claude Code process ended while your application was using it. Which error you see depends on the SDK language and on whether the CLI reported an error result before it exited. + +### + +​ + +ProcessError: Command failed with exit code + +The Python SDK raises a `ProcessError` when the Claude Code process exits with a nonzero code: + + Command failed with exit code 1 (exit code: 1) + Error output: Check stderr output for details + +The message states the exit code twice, and the `Error output` line is fixed text rather than your process’s error output. The same fixed text fills the exception’s `stderr` attribute. The exception’s `exit_code` attribute carries the code. To capture what the CLI actually wrote to stderr, pass a `stderr` callback in `ClaudeAgentOptions` and log what it receives. A bare `ProcessError` means the CLI exited without reporting an error result. When the CLI did report one, the SDK raises [`ResultError`](</docs/en/agent-sdk/python#resulterror>) instead, covered in Claude Code returned an error result. `ResultError` subclasses `ProcessError`, so `except ProcessError` catches both. To handle them differently, put the `except ResultError` clause first. Before `claude-agent-sdk` 0.2.140, the Python SDK raised error-result exits as a plain `Exception` rather than a `ResultError`. + +### + +​ + +Claude Code process exited with code N + +IDE wrappers print this message too, and the [error reference](</docs/en/errors#claude-code-process-exited-with-code-n>) covers it for VS Code and other launchers. This entry covers what your TypeScript SDK code receives. The SDK surfaces a nonzero CLI exit as a plain `Error` that rejects the `for await` loop over `query()`’s messages. There’s no SDK error class to catch, so wrap the loop in `try`/`catch` and match on the message: + + Claude Code process exited with code 1. stderr: <tail of the CLI's stderr> + +When the CLI wrote to stderr, the message ends with the tail of it. To capture the full stream, pass a `stderr` callback in the query options. A process killed by a signal reports `Claude Code process terminated by signal <name>` in the same form. + +### + +​ + +Claude Code returned an error result + +Both SDKs replace the process-exit error with this message when the CLI reported an error result before exiting: + + Claude Code returned an error result: <the CLI's own error report> + +The text after the colon is the CLI’s report of what went wrong, so start there rather than with the exit itself. Python raises this as a [`ResultError`](</docs/en/agent-sdk/python#resulterror>), whose `data` attribute carries the full error result. TypeScript rejects the message loop with a plain `Error` carrying the same message shape. + ## ​
modified
Show diff (200 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,161 +1,68 @@ -This page covers performance, stability, and search problems once Claude Code is running. For other issues, start with the page that matches where you’re stuck: - -Symptom| Go to ----|--- -`command not found`, install fails, PATH issues, `EACCES`, TLS errors| [Troubleshoot installation and login](</docs/en/troubleshoot-install>) -Update or install download fails with `The connection dropped while downloading the update` or `aborted`| [Error reference](</docs/en/errors#the-connection-dropped-while-downloading-the-update>) -Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) -Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) -`API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) -`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#theres-an-issue-with-the-selected-model>) -VS Code extension not connecting or detecting Claude| [VS Code integration](</docs/en/vs-code#fix-common-issues>) -`Claude Code process exited with code 1` in VS Code or an SDK app| [Error reference](</docs/en/errors#claude-code-process-exited-with-code-n>) -JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) -High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below - -If you’re not sure which applies, run `/doctor` inside Claude Code for an automated check of your installation, settings, extensions, and context usage; it proposes fixes it can apply after you confirm. If `claude` won’t start at all, run `claude doctor` from your shell instead. Run `/mcp` to check MCP server status. +Entries on this page are keyed to the error you see. Each names the cause and what to do. ## ​ -Performance and stability - -These sections cover issues related to resource usage, responsiveness, and search behavior. +CLI startup ### ​ -High CPU or memory usage +CLINotFoundError: Claude Code not found -Claude Code is designed to work with most development environments, but may consume significant resources when processing large codebases. If you’re experiencing performance issues: +The Python SDK launches the Claude Code CLI as a subprocess. When it can’t find a `claude` executable, connecting fails with a `CLINotFoundError`: - 1. Use `/compact` regularly to reduce context size. If it returns `Not enough messages to compact.`, the conversation has too few turns to summarize; that can happen even with a full context when a single large paste filled it - 2. Close and restart Claude Code between major tasks - 3. Consider adding large build directories to your `.gitignore` file - 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one + Claude Code not found at: /your/configured/path -If memory usage stays high after these steps, run `/heapdump` to write two files to `~/Desktop`: a JavaScript heap snapshot named `<session-id>.heapsnapshot` and a memory breakdown named `<session-id>-diagnostics.json`. The command doesn’t appear in the command menu; type it in full. On Linux without a Desktop folder, the files are written to your home directory. +The message includes the configured path when you set `ClaudeAgentOptions(cli_path=...)` and it points at a missing file. Without `cli_path`, the SDK searches your `PATH` and common install locations, and the message includes install instructions for your platform. To fix it: -The `.heapsnapshot` file contains every string in the process, including your full conversation and credentials. Don’t attach it to a public issue or share it. - -The command also prints a summary in the conversation, showing resident set size, JS heap, array buffers, and unaccounted native memory, plus any leak indicators it detected, such as a high memory growth rate or an unusually high number of open handles. The summary says whether most memory is in the JS heap, which the snapshot captures, or in native memory, which it doesn’t. Do one of two things with the output: - - * **Report it** : open a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) and attach only the `-diagnostics.json` file, which carries the statistics behind the printed summary and no conversation content or credentials - * **Investigate it yourself** : if the summary says most memory is JS heap, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load and sort by retained size to see what’s holding the memory - -If the summary says most memory is native, the snapshot can’t show it; include the summary’s leak indicators in your report instead. + * Install Claude Code if it isn’t installed. See [Install Claude Code](</docs/en/setup#install-claude-code>) for the command on your platform. + * If you set `cli_path`, confirm the file exists and is the `claude` executable. + * If you rely on `PATH` resolution, confirm `claude --version` works in the same environment your application runs in. Processes you launch outside your shell, such as from an IDE or a service manager, often run with a different `PATH`. ### ​ -Large tables are cut off in the terminal +CLIConnectionError: Refusing to execute batch script -A Markdown table with more than 200 rows renders its first 200 rows followed by a `… N more rows not shown` line. Only the display is capped: the full table stays in the conversation, and [`/copy`](</docs/en/commands>) copies every row. For a table too large to read in the terminal, ask Claude to write it to a file instead. Before v2.1.208, Claude Code rendered every row, so resuming a session that contained a very large table could stall while it re-rendered. +On Windows, connecting fails with a `CLIConnectionError` when the CLI path the Python SDK uses is a `.bat` or `.cmd` batch script, including the `claude.cmd` shim that an npm install creates: + + Refusing to execute batch script 'C:\\Users\\you\\AppData\\Roaming\\npm\\claude.cmd': Windows runs .bat/.cmd files via cmd.exe, which can execute commands injected through CLI arguments, and no reliable escaping for cmd.exe exists. Use a native claude executable instead: install Claude Code natively (irm https://claude.ai/install.ps1 | iex), point ClaudeAgentOptions(cli_path=...) at a claude.exe, or install the claude-agent-sdk wheel for a platform that bundles claude.exe (e.g. Windows x64). + +The refusal is deliberate security hardening, not a broken install. Windows runs batch scripts by rewriting the spawn into a `cmd.exe /c` invocation, and `cmd.exe` re-parses the whole command line at execution time, so an argument value can execute injected commands. Most Windows installs never reach this error. The Windows x64 wheel of `claude-agent-sdk` bundles a `claude.exe`, and the SDK prefers the bundled CLI, then any native `claude.exe` it can discover, before falling back to a batch shim. You see the refusal in two cases: + + * You set `ClaudeAgentOptions(cli_path=...)` to a `.bat` or `.cmd` file, such as npm’s `claude.cmd` shim. + * Your install has no bundled or native `claude.exe`, for example a source install on ARM64 Windows where the only `claude` on your `PATH` is the npm shim. + +To fix it, give the SDK a native executable instead of a batch script: + + * If you set `ClaudeAgentOptions(cli_path=...)`, point it at a `claude.exe` or remove the option. The SDK skips discovery while `cli_path` is set, so a native install alone can’t take effect. + * Install Claude Code natively in PowerShell: `irm https://claude.ai/install.ps1 | iex` + * On x64 Windows, install the `claude-agent-sdk` wheel, which bundles `claude.exe`. + +Before `claude-agent-sdk` 0.2.124, the Python SDK spawned batch scripts through `cmd.exe` without this check. + +## + +​ + +Structured outputs ### ​ -Auto-compaction stops with a thrashing error +structured_output is None but the result says success -If you see `Autocompact is thrashing: the context refilled to the limit...`, automatic compaction succeeded but a file or tool output immediately refilled the context window several times in a row. Claude Code stops retrying to avoid wasting API calls on a loop that isn’t making progress. To recover: - - 1. Ask Claude to read the oversized file in smaller chunks, such as a specific line range or function, instead of the whole file - 2. Run `/compact` with a focus that drops the large output, for example `/compact keep only the plan and the diff` - 3. Move the large-file work to a [subagent](</docs/en/sub-agents>) so it runs in a separate context window - 4. Run `/clear` if the earlier conversation is no longer needed - -### - -​ - -Command hangs or freezes - -If Claude Code seems unresponsive: - - 1. Press Ctrl+C to attempt to cancel the current operation - 2. If unresponsive, you may need to close the terminal and restart - -Restarting doesn’t lose your conversation. Run `claude --resume` in the same directory to pick the session back up. - -### - -​ - -Garbled or corrupted text in an editor’s integrated terminal - -If characters render as boxes, smears, or the wrong glyphs when running Claude Code in the VS Code, Cursor, or Devin Desktop integrated terminal, the terminal’s GPU renderer is likely the cause. Run `/terminal-setup` inside Claude Code to set `terminal.integrated.gpuAcceleration` to `"off"`, or set it manually in your editor settings and reload the window. See [Terminal configuration](</docs/en/terminal-config>) for the other settings `/terminal-setup` writes. - -### - -​ - -Search and discovery issues - -If the Search tool, `@file` mentions, custom agents, or custom skills aren’t finding files, the bundled `ripgrep` binary may not run on your system. Install your platform’s `ripgrep` package and tell Claude Code to use it instead: - - * macOS - - * Ubuntu/Debian - - * Alpine - - * Arch - - * Windows - - brew install ripgrep - - sudo apt install ripgrep - - apk add ripgrep - -`ripgrep` is in Alpine’s community repository. If `apk` reports that the package is missing, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>). - - pacman -S ripgrep - - winget install BurntSushi.ripgrep.MSVC - -Then set `USE_BUILTIN_RIPGREP` to `0`, either in your shell [environment](</docs/en/env-vars>) or in the `env` block of your [`settings.json`](</docs/en/settings#available-settings>): - - { - "env": { - "USE_BUILTIN_RIPGREP": "0" - } - } - -To confirm the switch took effect, run `claude doctor` in your terminal and check that the Search line shows the path of your system ripgrep instead of `OK (bundled)`. - -### - -​ - -Slow or incomplete search results on WSL - -Disk read performance penalties when [working across file systems on WSL](<https://learn.microsoft.com/en-us/windows/wsl/filesystems>) may result in fewer-than-expected matches when using Claude Code on WSL. Search still functions, but returns fewer results than on a native filesystem. - -`claude doctor` shows Search as OK in this case. - -**Solutions:** - - 1. **Submit more specific searches** : reduce the number of files searched by specifying directories or file types: “Search for JWT validation logic in the auth-service package” or “Find use of md5 hash in JS files”. - 2. **Move project to Linux filesystem** : if possible, ensure your project is located on the Linux filesystem (`/home/`) rather than the Windows filesystem (`/mnt/c/`). - 3. **Use native Windows instead** : consider running Claude Code natively on Windows instead of through WSL, for better file system performance. +A result message can end with `subtype: "success"` while `structured_output` is `None` in Python or `undefined` in TypeScript. The run completes, but no validated output exists. One way to hit this is a schema no output can satisfy, for example conflicting length constraints. The run ends without a validation error, and the only signal is the missing `structured_output`. Treat this result as a failure in application code. Check both that `subtype` is `success` and that `structured_output` is present before using it. The [Error handling](</docs/en/agent-sdk/structured-outputs#error-handling>) section shows this pattern for both SDKs. If it happens repeatedly with a schema you believe is correct, verify the schema is satisfiable, then simplify it until outputs validate, and reintroduce constraints one at a time. ## ​ -Get more help +Report a new issue -If you’re experiencing issues not covered here: - - 1. Run `/doctor` for a setup checkup and `/mcp` to check MCP server status - 2. Use the `/feedback` command within Claude Code to report problems directly to Anthropic - 3. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues - 4. Ask Claude directly about its capabilities and features. Claude has built-in access to its documentation. - -For account, billing, or subscription problems, contact Anthropic support instead: sign in at [claude.ai](<https://claude.ai>) (Console users: [platform.claude.com](<https://platform.claude.com>)), click your initials in the lower left, and select **Get help**. See [How to get support](<https://support.claude.com/en/articles/9015913-how-to-get-support>) for the full flow, including who can reach a human agent on each plan. +If your error isn’t covered here, check the open issues or file a new one in the SDK repositories: [claude-agent-sdk-typescript](<https://github.com/anthropics/claude-agent-sdk-typescript/issues>) or [claude-agent-sdk-python](<https://github.com/anthropics/claude-agent-sdk-python/issues>). Include the full error text and your SDK version.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -31,14 +31,21 @@ Claude Code is designed to work with most development environments, but may consume significant resources when processing large codebases. If you’re experiencing performance issues: - 1. Use `/compact` regularly to reduce context size + 1. Use `/compact` regularly to reduce context size. If it returns `Not enough messages to compact.`, the conversation has too few turns to summarize; that can happen even with a full context when a single large paste filled it 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one -If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load; the breakdown is the file ending in `-diagnostics.json`. +If memory usage stays high after these steps, run `/heapdump` to write two files to `~/Desktop`: a JavaScript heap snapshot named `<session-id>.heapsnapshot` and a memory breakdown named `<session-id>-diagnostics.json`. The command doesn’t appear in the command menu; type it in full. On Linux without a Desktop folder, the files are written to your home directory. -The `.heapsnapshot` file contains every string in the process. Don’t attach it to a public issue or share it. Attach only the `-diagnostics.json` file when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). That file contains memory statistics and no conversation content or credentials. +The `.heapsnapshot` file contains every string in the process, including your full conversation and credentials. Don’t attach it to a public issue or share it. + +The command also prints a summary in the conversation, showing resident set size, JS heap, array buffers, and unaccounted native memory, plus any leak indicators it detected, such as a high memory growth rate or an unusually high number of open handles. The summary says whether most memory is in the JS heap, which the snapshot captures, or in native memory, which it doesn’t. Do one of two things with the output: + + * **Report it** : open a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) and attach only the `-diagnostics.json` file, which carries the statistics behind the printed summary and no conversation content or credentials + * **Investigate it yourself** : if the summary says most memory is JS heap, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load and sort by retained size to see what’s holding the memory + +If the summary says most memory is native, the snapshot can’t show it; include the summary’s leak indicators in your report instead. ### @@ -112,7 +119,15 @@ winget install BurntSushi.ripgrep.MSVC -Then set `USE_BUILTIN_RIPGREP=0` in your [environment](</docs/en/env-vars>). To confirm the switch took effect, run `claude doctor` in your terminal and check that the Search line shows the path of your system ripgrep instead of `OK (bundled)`. +Then set `USE_BUILTIN_RIPGREP` to `0`, either in your shell [environment](</docs/en/env-vars>) or in the `env` block of your [`settings.json`](</docs/en/settings#available-settings>): + + { + "env": { + "USE_BUILTIN_RIPGREP": "0" + } + } + +To confirm the switch took effect, run `claude doctor` in your terminal and check that the Search line shows the path of your system ripgrep instead of `OK (bundled)`. ###
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -9,6 +9,7 @@ `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) `model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#theres-an-issue-with-the-selected-model>) VS Code extension not connecting or detecting Claude| [VS Code integration](</docs/en/vs-code#fix-common-issues>) +`Claude Code process exited with code 1` in VS Code or an SDK app| [Error reference](</docs/en/errors#claude-code-process-exited-with-code-n>) JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -35,7 +35,7 @@ 3. Consider adding large build directories to your `.gitignore` file 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one -If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. +If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load; the breakdown is the file ending in `-diagnostics.json`. The `.heapsnapshot` file contains every string in the process. Don’t attach it to a public issue or share it. Attach only the `-diagnostics.json` file when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). That file contains memory statistics and no conversation content or credentials.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -35,7 +35,9 @@ 3. Consider adding large build directories to your `.gitignore` file 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one -If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). +If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. + +The `.heapsnapshot` file contains every string in the process. Don’t attach it to a public issue or share it. Attach only the `-diagnostics.json` file when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). That file contains memory statistics and no conversation content or credentials. ### @@ -109,7 +111,7 @@ winget install BurntSushi.ripgrep.MSVC -Then set `USE_BUILTIN_RIPGREP=0` in your [environment](</docs/en/env-vars>). +Then set `USE_BUILTIN_RIPGREP=0` in your [environment](</docs/en/env-vars>). To confirm the switch took effect, run `claude doctor` in your terminal and check that the Search line shows the path of your system ripgrep instead of `OK (bundled)`. ### @@ -139,3 +141,5 @@ 2. Use the `/feedback` command within Claude Code to report problems directly to Anthropic 3. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues 4. Ask Claude directly about its capabilities and features. Claude has built-in access to its documentation. + +For account, billing, or subscription problems, contact Anthropic support instead: sign in at [claude.ai](<https://claude.ai>) (Console users: [platform.claude.com](<https://platform.claude.com>)), click your initials in the lower left, and select **Get help**. See [How to get support](<https://support.claude.com/en/articles/9015913-how-to-get-support>) for the full flow, including who can reach a human agent on each plan.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -103,6 +103,8 @@ apk add ripgrep +`ripgrep` is in Alpine’s community repository. If `apk` reports that the package is missing, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>). + pacman -S ripgrep winget install BurntSushi.ripgrep.MSVC
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -36,6 +36,14 @@ 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). + +### + +​ + +Large tables are cut off in the terminal + +A Markdown table with more than 200 rows renders its first 200 rows followed by a `… N more rows not shown` line. Only the display is capped: the full table stays in the conversation, and [`/copy`](</docs/en/commands>) copies every row. For a table too large to read in the terminal, ask Claude to write it to a file instead. Before v2.1.208, Claude Code rendered every row, so resuming a session that contained a very large table could stall while it re-rendered. ###
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -7,7 +7,7 @@ Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) -`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#there%E2%80%99s-an-issue-with-the-selected-model>) +`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#theres-an-issue-with-the-selected-model>) VS Code extension not connecting or detecting Claude| [VS Code integration](</docs/en/vs-code#fix-common-issues>) JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -12,7 +12,7 @@ JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below -If you’re not sure which applies, run `/doctor` inside Claude Code for an automated check of your installation, settings, MCP servers, and context usage. If `claude` won’t start at all, run `claude doctor` from your shell instead. +If you’re not sure which applies, run `/doctor` inside Claude Code for an automated check of your installation, settings, extensions, and context usage; it proposes fixes it can apply after you confirm. If `claude` won’t start at all, run `claude doctor` from your shell instead. Run `/mcp` to check MCP server status. ## @@ -109,7 +109,7 @@ Disk read performance penalties when [working across file systems on WSL](<https://learn.microsoft.com/en-us/windows/wsl/filesystems>) may result in fewer-than-expected matches when using Claude Code on WSL. Search still functions, but returns fewer results than on a native filesystem. -`/doctor` will show Search as OK in this case. +`claude doctor` shows Search as OK in this case. **Solutions:** @@ -125,7 +125,7 @@ If you’re experiencing issues not covered here: - 1. Run `/doctor` to check installation health, settings validity, MCP configuration, and context usage in one pass + 1. Run `/doctor` for a setup checkup and `/mcp` to check MCP server status 2. Use the `/feedback` command within Claude Code to report problems directly to Anthropic 3. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues 4. Ask Claude directly about its capabilities and features. Claude has built-in access to its documentation.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -3,6 +3,7 @@ Symptom| Go to ---|--- `command not found`, install fails, PATH issues, `EACCES`, TLS errors| [Troubleshoot installation and login](</docs/en/troubleshoot-install>) +Update or install download fails with `The connection dropped while downloading the update` or `aborted`| [Error reference](</docs/en/errors#the-connection-dropped-while-downloading-the-update>) Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>)
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -3,7 +3,7 @@ Symptom| Go to ---|--- `command not found`, install fails, PATH issues, `EACCES`, TLS errors| [Troubleshoot installation and login](</docs/en/troubleshoot-install>) -Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Bedrock/Vertex/Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) +Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Amazon Bedrock, Google Cloud’s Agent Platform, or Microsoft Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) `model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#there%E2%80%99s-an-issue-with-the-selected-model>)
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -32,6 +32,7 @@ 1. Use `/compact` regularly to reduce context size 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file + 4. Restart with [`claude --safe-mode`](</docs/en/cli-reference#cli-flags>) to check whether a plugin, MCP server, or hook is the source. It disables all customizations for the session; if usage drops, see [Debug your configuration](</docs/en/debug-your-config#test-against-a-clean-configuration>) to find which one If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>).
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,9 +1,3 @@ -> ## Documentation Index -> -> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> -> -> Use this file to discover all available pages before exploring further. - This page covers performance, stability, and search problems once Claude Code is running. For other issues, start with the page that matches where you’re stuck: Symptom| Go to @@ -71,6 +65,14 @@ ​ +Garbled or corrupted text in an editor’s integrated terminal + +If characters render as boxes, smears, or the wrong glyphs when running Claude Code in the VS Code, Cursor, or Devin Desktop integrated terminal, the terminal’s GPU renderer is likely the cause. Run `/terminal-setup` inside Claude Code to set `terminal.integrated.gpuAcceleration` to `"off"`, or set it manually in your editor settings and reload the window. See [Terminal configuration](</docs/en/terminal-config>) for the other settings `/terminal-setup` writes. + +### + +​ + Search and discovery issues If the Search tool, `@file` mentions, custom agents, or custom skills aren’t finding files, the bundled `ripgrep` binary may not run on your system. Install your platform’s `ripgrep` package and tell Claude Code to use it instead:
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -12,7 +12,7 @@ Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Bedrock/Vertex/Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) -`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#theres-an-issue-with-the-selected-model>) +`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#there%E2%80%99s-an-issue-with-the-selected-model>) VS Code extension not connecting or detecting Claude| [VS Code integration](</docs/en/vs-code#fix-common-issues>) JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below
modified
Show diff (934 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -1,702 +1,23 @@ -## +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. -​ +This page covers performance, stability, and search problems once Claude Code is running. For other issues, start with the page that matches where you’re stuck: -Troubleshoot installation issues +Symptom| Go to +---|--- +`command not found`, install fails, PATH issues, `EACCES`, TLS errors| [Troubleshoot installation and login](</docs/en/troubleshoot-install>) +Login loops, OAuth errors, `403 Forbidden`, “organization disabled”, Bedrock/Vertex/Foundry credentials| [Troubleshoot installation and login](</docs/en/troubleshoot-install#login-and-authentication>) +Settings not applying, hooks not firing, MCP servers not loading| [Debug your configuration](</docs/en/debug-your-config>) +`API Error: 5xx`, `529 Overloaded`, `429`, request validation errors| [Error reference](</docs/en/errors>) +`model not found` or `you may not have access to it`| [Error reference](</docs/en/errors#theres-an-issue-with-the-selected-model>) +VS Code extension not connecting or detecting Claude| [VS Code integration](</docs/en/vs-code#fix-common-issues>) +JetBrains plugin or IDE not detected| [JetBrains integration](</docs/en/jetbrains#troubleshooting>) +High CPU or memory, slow responses, hangs, search not finding files| Performance and stability below -If you’d rather skip the terminal entirely, the [Claude Code Desktop app](</docs/en/desktop-quickstart>) lets you install and use Claude Code through a graphical interface. Download it for [macOS](<https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs>) or [Windows](<https://claude.com/download?utm_source=claude_code&utm_medium=docs>) and start coding without any command-line setup. - -Find the error message or symptom you’re seeing: - -What you see| Solution ----|--- -`command not found: claude` or `'claude' is not recognized`| Fix your PATH -`syntax error near unexpected token '<'`| Install script returns HTML -`curl: (56) Failure writing output to destination`| Download script first, then run it -`Killed` during install on Linux| Add swap space for low-memory servers -`TLS connect error` or `SSL/TLS secure channel`| Update CA certificates -`Failed to fetch version` or can’t reach download server| Check network and proxy settings -`irm is not recognized` or `&& is not valid`| Use the right command for your shell -`'bash' is not recognized as the name of a cmdlet`| Use the Windows installer command -`Claude Code on Windows requires either Git for Windows (for bash) or PowerShell`| Install a shell -`Claude Code does not support 32-bit Windows`| Open Windows PowerShell, not the x86 entry -`Error loading shared library`| Wrong binary variant for your system -`Illegal instruction` on Linux| Architecture mismatch -`dyld: cannot load`, `dyld: Symbol not found`, or `Abort trap` on macOS| Binary incompatibility -`Invoke-Expression: Missing argument in parameter list`| Install script returns HTML -`App unavailable in region`| Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). -`unable to get local issuer certificate`| Configure corporate CA certificates -`OAuth error` or `403 Forbidden`| Fix authentication -`API Error: 500`, `529 Overloaded`, `429`, or other 4xx and 5xx errors not listed above| See the [Error reference](</docs/en/errors>) - -If your issue isn’t listed, work through these diagnostic steps. - -## - -​ - -Debug installation problems - -### - -​ - -Check network connectivity - -The installer downloads from `downloads.claude.ai`. Verify you can reach it: - - curl -sI https://downloads.claude.ai - -If this fails, your network may be blocking the connection. Common causes: - - * Corporate firewalls or proxies blocking `downloads.claude.ai` - * Regional network restrictions: try a VPN or alternative network - * TLS/SSL issues: update your system’s CA certificates, or check if `HTTPS_PROXY` is configured - -If you’re behind a corporate proxy, set `HTTPS_PROXY` and `HTTP_PROXY` to your proxy’s address before installing. Ask your IT team for the proxy URL if you don’t know it, or check your browser’s proxy settings. This example sets both proxy variables, then runs the installer through your proxy: - - export HTTP_PROXY=http://proxy.example.com:8080 - export HTTPS_PROXY=http://proxy.example.com:8080 - curl -fsSL https://claude.ai/install.sh | bash - -### - -​ - -Verify your PATH - -If installation succeeded but you get a `command not found` or `not recognized` error when running `claude`, the install directory isn’t in your PATH. Your shell searches for programs in directories listed in PATH, and the installer places `claude` at `~/.local/bin/claude` on macOS/Linux or `%USERPROFILE%\.local\bin\claude.exe` on Windows. Check if the install directory is in your PATH by listing your PATH entries and filtering for `local/bin`: - - * macOS/Linux - - * Windows PowerShell - - * Windows CMD - - echo $PATH | tr ':' '\n' | grep local/bin - -If there’s no output, the directory is missing. Add it to your shell configuration: - - # Zsh (macOS default) - echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc - source ~/.zshrc - - # Bash (Linux default) - echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc - source ~/.bashrc - -Alternatively, close and reopen your terminal.Verify the fix worked: - - claude --version - - $env:PATH -split ';' | Select-String 'local\\bin' - -If there’s no output, add the install directory to your User PATH: - - $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') - [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User') - -Restart your terminal for the change to take effect.Verify the fix worked: - - claude --version - - echo %PATH% | findstr /i "local\bin" - -If there’s no output, open System Settings, go to Environment Variables, and add `%USERPROFILE%\.local\bin` to your User PATH variable. Restart your terminal.Verify the fix worked: - - claude --version - -### - -​ - -Check for conflicting installations - -Multiple Claude Code installations can cause version mismatches or unexpected behavior. Check what’s installed: - - * macOS/Linux - - * Windows PowerShell - -List all `claude` binaries found in your PATH: - - which -a claude - -Check whether the native installer and npm versions are present: - - ls -la ~/.local/bin/claude - - ls -la ~/.claude/local/ - - npm -g ls @anthropic-ai/claude-code 2>/dev/null - - where.exe claude - Test-Path "$env:LOCALAPPDATA\Claude Code\claude.exe" - -If you find multiple installations, keep only one. The native install at `~/.local/bin/claude` is recommended. Remove any extra installations: Uninstall an npm global install: - - npm uninstall -g @anthropic-ai/claude-code - -Remove a Homebrew install on macOS (use `claude-code@latest` if you installed that cask): - - brew uninstall --cask claude-code - -### - -​ - -Check directory permissions - -The installer needs write access to `~/.local/bin/` and `~/.claude/`. If installation fails with permission errors, check whether these directories are writable: - - test -w ~/.local/bin && echo "writable" || echo "not writable" - test -w ~/.claude && echo "writable" || echo "not writable" - -If either directory isn’t writable, create the install directory and set your user as the owner: - - sudo mkdir -p ~/.local/bin - sudo chown -R $(whoami) ~/.local - -### - -​ - -Verify the binary works - -If `claude` is installed but crashes or hangs on startup, run these checks to narrow down the cause. Confirm the binary exists and is executable: - - ls -la $(which claude) - -On Linux, check for missing shared libraries. If `ldd` shows missing libraries, you may need to install system packages. On Alpine Linux and other musl-based distributions, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>). - - ldd $(which claude) | grep "not found" - -Run a quick sanity check that the binary can execute: - - claude --version - -## - -​ - -Common installation issues - -These are the most frequently encountered installation problems and their solutions. - -### - -​ - -Install script returns HTML instead of a shell script - -When running the install command, you may see one of these errors: - - bash: line 1: syntax error near unexpected token `<' - bash: line 1: `<!DOCTYPE html>' - -On PowerShell, the same problem appears as: - - Invoke-Expression: Missing argument in parameter list. - -This means the install URL returned an HTML page instead of the install script. If the HTML page says “App unavailable in region,” Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). Otherwise, this can happen due to network issues, regional routing, or a temporary service disruption. **Solutions:** - - 1. **Use an alternative install method** : On macOS or Linux, install via Homebrew: - - brew install --cask claude-code - -On Windows, install via WinGet: - - winget install Anthropic.ClaudeCode - - 2. **Retry after a few minutes** : the issue is often temporary. Wait and try the original command again. - -### - -​ - -`command not found: claude` after installation - -The install finished but `claude` doesn’t work. The exact error varies by platform: - -Platform| Error message ----|--- -macOS| `zsh: command not found: claude` -Linux| `bash: claude: command not found` -Windows CMD| `'claude' is not recognized as an internal or external command` -PowerShell| `claude : The term 'claude' is not recognized as the name of a cmdlet` - -This means the install directory isn’t in your shell’s search path. See Verify your PATH for the fix on each platform. - -### - -​ - -`curl: (56) Failure writing output to destination` - -The `curl ... | bash` command downloads the script and passes it directly to Bash for execution using a pipe (`|`). This error means the connection broke before the script finished downloading. Common causes include network interruptions, the download being blocked mid-stream, or system resource limits. **Solutions:** - - 1. **Check network stability** : Claude Code binaries are hosted at `downloads.claude.ai`. Test that you can reach it: - - curl -fsSL https://downloads.claude.ai -o /dev/null - -If the command completes silently, your connection is fine and the issue is likely intermittent. Retry the install command. If you see an error, your network may be blocking the download. - 2. **Try an alternative install method** : On macOS or Linux: - - brew install --cask claude-code - -On Windows: - - winget install Anthropic.ClaudeCode - -### - -​ - -TLS or SSL connection errors - -Errors like `curl: (35) TLS connect error`, `schannel: next InitializeSecurityContext failed`, or PowerShell’s `Could not establish trust relationship for the SSL/TLS secure channel` indicate TLS handshake failures. **Solutions:** - - 1. **Update your system CA certificates** : On Ubuntu/Debian: - - sudo apt-get update && sudo apt-get install ca-certificates - -On macOS via Homebrew: - - brew install ca-certificates - - 2. **On Windows, enable TLS 1.2** in PowerShell before running the installer: - - [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 - irm https://claude.ai/install.ps1 | iex - - 3. **Check for proxy or firewall interference** : corporate proxies that perform TLS inspection can cause these errors, including `unable to get local issuer certificate`. Set `NODE_EXTRA_CA_CERTS` to your corporate CA certificate bundle: - - export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem - -Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. - 4. **On Windows, bypass certificate revocation checks** if you see `CRYPT_E_NO_REVOCATION_CHECK (0x80092012)` or `CRYPT_E_REVOCATION_OFFLINE (0x80092013)`. These mean curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. Add `--ssl-revoke-best-effort` to the install command: - - curl --ssl-revoke-best-effort -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd - -Alternatively, install with `winget install Anthropic.ClaudeCode`, which avoids curl entirely. - -### - -​ - -`Failed to fetch version from downloads.claude.ai` - -The installer couldn’t reach the download server. This typically means `downloads.claude.ai` is blocked on your network. **Solutions:** - - 1. **Test connectivity directly** : - - curl -sI https://downloads.claude.ai - - 2. **If behind a proxy** , set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](</docs/en/network-config#proxy-configuration>) for details. - - export HTTPS_PROXY=http://proxy.example.com:8080 - curl -fsSL https://claude.ai/install.sh | bash - - 3. **If on a restricted network** , try a different network or VPN, or use an alternative install method: On macOS or Linux: - - brew install --cask claude-code - -On Windows: - - winget install Anthropic.ClaudeCode - -### - -​ - -Windows: wrong install command - -If you see `'irm' is not recognized`, `The token '&&' is not valid`, or `'bash' is not recognized as the name of a cmdlet`, you copied the install command for a different shell or operating system. - - * **`irm` not recognized**: you’re in CMD, not PowerShell. You have two options: Open PowerShell by searching for “PowerShell” in the Start menu, then run the original install command: - - irm https://claude.ai/install.ps1 | iex - -Or stay in CMD and use the CMD installer instead: - - curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd - - * **`&&` not valid**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: - - irm https://claude.ai/install.ps1 | iex - - * **`bash` not recognized**: you ran the macOS/Linux installer on Windows. Use the PowerShell installer instead: - - irm https://claude.ai/install.ps1 | iex - -### - -​ - -Install killed on low-memory Linux servers - -If you see `Killed` during installation on a VPS or cloud instance: - - Setting up Claude Code... - Installing Claude Code native build latest... - bash: line 142: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"} - -The Linux OOM killer terminated the process because the system ran out of memory. Claude Code requires at least 4 GB of available RAM. **Solutions:** - - 1. **Add swap space** if your server has limited RAM. Swap uses disk space as overflow memory, letting the install complete even with low physical RAM. Create a 2 GB swap file and enable it: - - sudo fallocate -l 2G /swapfile - sudo chmod 600 /swapfile - sudo mkswap /swapfile - sudo swapon /swapfile - -Then retry the installation: - - curl -fsSL https://claude.ai/install.sh | bash - - 2. **Close other processes** to free memory before installing. - 3. **Use a larger instance** if possible. Claude Code requires at least 4 GB of RAM. - -### - -​ - -Install hangs in Docker - -When installing Claude Code in a Docker container, installing as root into `/` can cause hangs. **Solutions:** - - 1. **Set a working directory** before running the installer. When run from `/`, the installer scans the entire filesystem, which causes excessive memory usage. Setting `WORKDIR` limits the scan to a small directory: - - WORKDIR /tmp - RUN curl -fsSL https://claude.ai/install.sh | bash - - 2. **Increase Docker memory limits** if using Docker Desktop: - - docker build --memory=4g . - -### - -​ - -Windows: Claude Desktop overrides `claude` CLI command - -If you installed an older version of Claude Desktop, it may register a `Claude.exe` in the `WindowsApps` directory that takes PATH priority over Claude Code CLI. Running `claude` opens the Desktop app instead of the CLI. Update Claude Desktop to the latest version to fix this issue. - -### - -​ - -Windows: “Claude Code on Windows requires either Git for Windows (for bash) or PowerShell” - -Claude Code on native Windows needs at least one shell: either [Git for Windows](<https://git-scm.com/downloads/win>) for Bash, or PowerShell. When neither is found, this error appears at startup. If only PowerShell is found, Claude Code uses the PowerShell tool instead of Bash. **If neither is installed** , install one: - - * Git for Windows: download from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. - * PowerShell 7: download from [aka.ms/powershell](<https://aka.ms/powershell>). - -**If Git is already installed** but Claude Code can’t find it, set the path in your [settings.json file](</docs/en/settings>): - - { - "env": { - "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe" - } - } - -If your Git is installed somewhere else, find the path by running `where.exe git` in PowerShell and use the `bin\bash.exe` path from that directory. - -### - -​ - -Windows: Claude Code does not support 32-bit Windows - -Windows includes two PowerShell entries in the Start menu: `Windows PowerShell` and `Windows PowerShell (x86)`. The x86 entry runs as a 32-bit process and triggers this error even on a 64-bit machine. To check which case you’re in, run this in the same window that produced the error: - - [Environment]::Is64BitOperatingSystem - -If this prints `True`, your operating system is fine. Close the window, open `Windows PowerShell` without the x86 suffix, and run the install command again. If this prints `False`, you are on a 32-bit edition of Windows. Claude Code requires a 64-bit operating system. See the [system requirements](</docs/en/setup#system-requirements>). - -### - -​ - -Linux: wrong binary variant installed (musl/glibc mismatch) - -If you see errors about missing shared libraries like `libstdc++.so.6` or `libgcc_s.so.1` after installation, the installer may have downloaded the wrong binary variant for your system. - - Error loading shared library libstdc++.so.6: No such file or directory - -This can happen on glibc-based systems that have musl cross-compilation packages installed, causing the installer to misdetect the system as musl. **Solutions:** - - 1. **Check which libc your system uses** : - - ldd /bin/ls | head -1 - -If it shows `linux-vdso.so` or references to `/lib/x86_64-linux-gnu/`, you’re on glibc. If it shows `musl`, you’re on musl. - 2. **If you’re on glibc but got the musl binary** , remove the installation and reinstall. You can also manually download the correct binary using the manifest at `https://downloads.claude.ai/claude-code-releases/{VERSION}/manifest.json`. File a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output of `ldd /bin/ls` and `ls /lib/libc.musl*`. - 3. **If you’re actually on musl** (Alpine Linux), install the required packages: - - apk add libgcc libstdc++ ripgrep - -### - -​ - -`Illegal instruction` on Linux - -If the installer prints `Illegal instruction` instead of the OOM `Killed` message, the downloaded binary doesn’t match your CPU architecture. This commonly happens on ARM servers that receive an x86 binary, or on older CPUs that lack required instruction sets. - - bash: line 142: 2238232 Illegal instruction "$binary_path" install ${TARGET:+"$TARGET"} - -**Verify your architecture** : - - uname -m - -`x86_64` means 64-bit Intel/AMD, `aarch64` means ARM64. If the binary doesn’t match, [file a GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output. Alternative install methods download the same architecture-specific binary and won’t resolve this error. - -### - -​ - -`dyld: cannot load` on macOS - -If you see `dyld: cannot load`, `dyld: Symbol not found`, or `Abort trap: 6` during installation, the binary is incompatible with your macOS version or hardware. - - dyld: cannot load 'claude-2.1.42-darwin-x64' (load command 0x80000034 is unknown) - Abort trap: 6 - -A `Symbol not found` error that references `libicucore` also indicates your macOS version is older than the binary supports: - - dyld: Symbol not found: _ubrk_clone - Referenced from: claude-darwin-x64 (which was built for Mac OS X 13.0) - Expected in: /usr/lib/libicucore.A.dylib - -**Solutions:** - - 1. **Check your macOS version** : Claude Code requires macOS 13.0 or later. Open the Apple menu and select About This Mac to check your version. - 2. **Update macOS** if you’re on an older version. The binary uses load commands and system libraries that older macOS versions don’t support. Alternative install methods like Homebrew download the same binary and won’t resolve this error. - -### - -​ - -Windows installation issues: errors in WSL - -You might encounter the following issues in WSL: **OS/platform detection issues** : if you receive an error during installation, WSL may be using Windows `npm`. Try: - - * Run `npm config set os linux` before installation - * Install with `npm install -g @anthropic-ai/claude-code --force --no-os-check`. Do not use `sudo`. - -**Node not found errors** : if you see `exec: node: not found` when running `claude`, your WSL environment may be using a Windows installation of Node.js. You can confirm this with `which npm` and `which node`, which should point to Linux paths starting with `/usr/` rather than `/mnt/c/`. To fix this, try installing Node via your Linux distribution’s package manager or via [`nvm`](<https://github.com/nvm-sh/nvm>). **nvm version conflicts** : if you have nvm installed in both WSL and Windows, you may experience version conflicts when switching Node versions in WSL. This happens because WSL imports the Windows PATH by default, causing Windows nvm/npm to take priority over the WSL installation. You can identify this issue by: - - * Running `which npm` and `which node` \- if they point to Windows paths (starting with `/mnt/c/`), Windows versions are being used - * Experiencing broken functionality after switching Node versions with nvm in WSL - -To resolve this issue, fix your Linux PATH to ensure the Linux node/npm versions take priority: **Primary solution: Ensure nvm is properly loaded in your shell** The most common cause is that nvm isn’t loaded in non-interactive shells. Add the following to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.): - - # Load nvm if it exists - export NVM_DIR="$HOME/.nvm" - [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" - [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" - -Or run directly in your current session: - - source ~/.nvm/nvm.sh - -**Alternative: Adjust PATH order** If nvm is properly loaded but Windows paths still take priority, you can explicitly prepend your Linux paths to PATH in your shell configuration: - - export PATH="$HOME/.nvm/versions/node/$(node -v)/bin:$PATH" - -Avoid disabling Windows PATH importing via `appendWindowsPath = false` as this breaks the ability to call Windows executables from WSL. Similarly, avoid uninstalling Node.js from Windows if you use it for Windows development. - -### - -​ - -WSL2 sandbox setup - -[Sandboxing](</docs/en/sandboxing>) is supported on WSL2 but requires installing additional packages. If you see an error about missing `bubblewrap` or `socat` when running `/sandbox`, install the dependencies: - - * Ubuntu/Debian - - * Fedora - - sudo apt-get install bubblewrap socat - - sudo dnf install bubblewrap socat - -WSL1 does not support sandboxing. If you see “Sandboxing requires WSL2”, you need to upgrade to WSL2 or run Claude Code without sandboxing. Sandboxed commands cannot launch Windows binaries such as `cmd.exe`, `powershell.exe`, or executables under `/mnt/c/`. WSL hands these off to the Windows host over a Unix socket, which the sandbox blocks. If a command needs to invoke a Windows binary, add it to [`excludedCommands`](</docs/en/settings#sandbox-settings>) so it runs outside the sandbox. - -### - -​ - -Permission errors during installation - -If the native installer fails with permission errors, the target directory may not be writable. See Check directory permissions. If you previously installed with npm and are hitting npm-specific permission errors, switch to the native installer: - - curl -fsSL https://claude.ai/install.sh | bash - -### - -​ - -Native binary not found after npm install - -The `@anthropic-ai/claude-code` npm package pulls in the native binary through a per-platform optional dependency such as `@anthropic-ai/claude-code-darwin-arm64`. If running `claude` after install prints `Could not find native binary package "@anthropic-ai/claude-code-<platform>"`, check the following causes: - - * **Optional dependencies are disabled.** Remove `--omit=optional` from your npm install command, `--no-optional` from pnpm, or `--ignore-optional` from yarn, and check that `.npmrc` does not set `optional=false`. Then reinstall. The native binary is delivered only as an optional dependency, so there is no JavaScript fallback if it is skipped. - * **Unsupported platform.** Prebuilt binaries are published for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Claude Code does not ship a binary for other platforms; see the [system requirements](</docs/en/setup#system-requirements>). - * **Corporate npm mirror is missing the platform packages.** Ensure your registry mirrors all eight `@anthropic-ai/claude-code-*` platform packages in addition to the meta package. - -Installing with `--ignore-scripts` does not trigger this error. The postinstall step that links the binary into place is skipped, so Claude Code falls back to a wrapper that locates and spawns the platform binary on each launch. This works but starts more slowly; reinstall with scripts enabled for direct execution. - -## - -​ - -Permissions and authentication - -These sections address login failures, token issues, and permission prompt behavior. - -### - -​ - -Repeated permission prompts - -If you find yourself repeatedly approving the same commands, you can allow specific tools to run without approval using the `/permissions` command. See [Permissions docs](</docs/en/permissions#manage-permissions>). - -### - -​ - -Authentication issues - -If you’re experiencing authentication problems: - - 1. Run `/logout` to sign out completely - 2. Close Claude Code - 3. Restart with `claude` and complete the authentication process again - -If the browser doesn’t open automatically during login, press `c` to copy the OAuth URL to your clipboard, then paste it into your browser manually. - -### - -​ - -OAuth error: Invalid code - -If you see `OAuth error: Invalid code. Please make sure the full code was copied`, the login code expired or was truncated during copy-paste. **Solutions:** - - * Press Enter to retry and complete the login quickly after the browser opens - * Type `c` to copy the full URL if the browser doesn’t open automatically - * If using a remote/SSH session, the browser may open on the wrong machine. Copy the URL displayed in the terminal and open it in your local browser instead. - -### - -​ - -403 Forbidden after login - -If you see `API Error: 403 {"error":{"type":"forbidden","message":"Request not allowed"}}` after logging in: - - * **Claude Pro/Max users** : verify your subscription is active at [claude.ai/settings](<https://claude.ai/settings>) - * **Console users** : confirm your account has the “Claude Code” or “Developer” role assigned by your admin - * **Behind a proxy** : corporate proxies can interfere with API requests. See [network configuration](</docs/en/network-config>) for proxy setup. - -### - -​ - -Model not found or not accessible - -If you see `There's an issue with the selected model (...). It may not exist or you may not have access to it`, the API rejected the configured model name. Common causes: - - * A typo in the model name passed to `--model` - * A stale or deprecated model ID saved in your settings - * An API key without access to that model on your current usage tier - -Check where the model is set, in [priority order](</docs/en/model-config#setting-your-model>): - - * The `--model` flag - * The `ANTHROPIC_MODEL` environment variable - * The `model` field in `.claude/settings.local.json` - * The `model` field in your project’s `.claude/settings.json` - * The `model` field in `~/.claude/settings.json` - -To clear a stale value, remove the `model` field from your settings or unset `ANTHROPIC_MODEL`, and Claude Code will fall back to the default model for your account. To browse models available to your account, start `claude` interactively and run `/model` to open the picker. For Vertex AI deployments, see [the Vertex AI troubleshooting section](</docs/en/google-vertex-ai#troubleshooting>). - -### - -​ - -This organization has been disabled with an active subscription - -If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode (`-p`), the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile: - - unset ANTHROPIC_API_KEY - claude - -Check `~/.zshrc`, `~/.bashrc`, or `~/.profile` for `export ANTHROPIC_API_KEY=...` lines and remove them to make the change permanent. Run `/status` inside Claude Code to confirm which authentication method is active. - -### - -​ - -OAuth login fails in WSL2 - -Browser-based login in WSL2 may fail if WSL can’t open your Windows browser. Set the `BROWSER` environment variable: - - export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" - claude - -Or copy the URL manually: when the login prompt appears, press `c` to copy the OAuth URL, then paste it into your Windows browser. - -### - -​ - -Not logged in or token expired - -If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. On macOS, login can also fail when the Keychain is locked or its password is out of sync with your account password, which prevents Claude Code from saving credentials. Run `claude doctor` to check Keychain access. To unlock the Keychain manually, run `security unlock-keychain ~/Library/Keychains/login.keychain-db`. If unlocking doesn’t help, open Keychain Access, select the `login` keychain, and choose Edit > Change Password for Keychain “login” to resync it with your account password. - -## - -​ - -Configuration file locations - -Claude Code stores configuration in several locations: - -File| Purpose ----|--- -`~/.claude/settings.json`| User settings (permissions, hooks, model overrides) -`.claude/settings.json`| Project settings (checked into source control) -`.claude/settings.local.json`| Local project settings (not committed) -`~/.claude.json`| Global state (theme, OAuth, MCP servers) -`.mcp.json`| Project MCP servers (checked into source control) -`managed-mcp.json`| [Managed MCP servers](</docs/en/mcp#managed-mcp-configuration>) -Managed settings| [Managed settings](</docs/en/settings#settings-files>) (server-managed, MDM/OS-level policies, or file-based) - -On Windows, `~` refers to your user home directory, such as `C:\Users\YourName`. For details on configuring these files, see [Settings](</docs/en/settings>) and [MCP](</docs/en/mcp>). - -### - -​ - -Resetting configuration - -To reset Claude Code to default settings, you can remove the configuration files: - - # Reset all user settings and state - rm ~/.claude.json - rm -rf ~/.claude/ - - # Reset project-specific settings - rm -rf .claude/ - rm .mcp.json - -This will remove all your settings, MCP server configurations, and session history. +If you’re not sure which applies, run `/doctor` inside Claude Code for an automated check of your installation, settings, MCP servers, and context usage. If `claude` won’t start at all, run `claude doctor` from your shell instead. ## @@ -718,7 +39,7 @@ 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file -If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. Open the `.heapsnapshot` file in Chrome DevTools under Memory → Load to inspect retainers. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). +If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. On Linux without a Desktop folder, the files are written to your home directory. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. To inspect retainers, open the `.heapsnapshot` file in Chrome DevTools under Memory → Load. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). ### @@ -744,28 +65,35 @@ 1. Press Ctrl+C to attempt to cancel the current operation 2. If unresponsive, you may need to close the terminal and restart +Restarting doesn’t lose your conversation. Run `claude --resume` in the same directory to pick the session back up. + ### ​ Search and discovery issues -If Search tool, `@file` mentions, custom agents, and custom skills aren’t working, install system `ripgrep`: +If the Search tool, `@file` mentions, custom agents, or custom skills aren’t finding files, the bundled `ripgrep` binary may not run on your system. Install your platform’s `ripgrep` package and tell Claude Code to use it instead: - # macOS (Homebrew) + * macOS + + * Ubuntu/Debian + + * Alpine + + * Arch + + * Windows + brew install ripgrep - # Windows (winget) - winget install BurntSushi.ripgrep.MSVC - - # Ubuntu/Debian sudo apt install ripgrep - # Alpine Linux apk add ripgrep - # Arch Linux pacman -S ripgrep + + winget install BurntSushi.ripgrep.MSVC Then set `USE_BUILTIN_RIPGREP=0` in your [environment](</docs/en/env-vars>). @@ -789,156 +117,11 @@ ​ -IDE integration issues - -If Claude Code does not connect to your IDE or behaves unexpectedly within an IDE terminal, try the solutions below. - -### - -​ - -JetBrains IDE not detected on WSL2 - -If you’re using Claude Code on WSL2 with JetBrains IDEs and getting “No available IDEs detected” errors, this is likely due to WSL2’s networking configuration or Windows Firewall blocking the connection. - -#### - -​ - -WSL2 networking modes - -WSL2 uses NAT networking by default, which can prevent IDE detection. You have two options: **Option 1: Configure Windows Firewall** (recommended) - - 1. Find your WSL2 IP address: - - wsl hostname -I - # Example output: 172.21.123.45 - - 2. Open PowerShell as Administrator and create a firewall rule: - - New-NetFirewallRule -DisplayName "Allow WSL2 Internal Traffic" -Direction Inbound -Protocol TCP -Action Allow -RemoteAddress 172.21.0.0/16 -LocalAddress 172.21.0.0/16 - -Adjust the IP range based on your WSL2 subnet from step 1. - 3. Restart both your IDE and Claude Code - -**Option 2: Switch to mirrored networking** Add to `.wslconfig` in your Windows user directory: - - [wsl2] - networkingMode=mirrored - -Then restart WSL with `wsl --shutdown` from PowerShell. - -These networking issues only affect WSL2. WSL1 uses the host’s network directly and doesn’t require these configurations. - -For additional JetBrains configuration tips, see the [JetBrains IDE guide](</docs/en/jetbrains#plugin-settings>). - -### - -​ - -Report Windows IDE integration issues - -If you’re experiencing IDE integration problems on Windows, [create an issue](<https://github.com/anthropics/claude-code/issues>) with the following information: - - * Environment type: native Windows (Git Bash) or WSL1/WSL2 - * WSL networking mode, if applicable: NAT or mirrored - * IDE name and version - * Claude Code extension/plugin version - * Shell type: Bash, Zsh, PowerShell, etc. - -### - -​ - -Escape key not working in JetBrains IDE terminals - -If you’re using Claude Code in JetBrains terminals and the `Esc` key doesn’t interrupt the agent as expected, this is likely due to a keybinding clash with JetBrains’ default shortcuts. To fix this issue: - - 1. Go to Settings → Tools → Terminal - 2. Either: - * Uncheck “Move focus to the editor with Escape”, or - * Click “Configure terminal keybindings” and delete the “Switch focus to Editor” shortcut - 3. Apply the changes - -This allows the `Esc` key to properly interrupt Claude Code operations. - -## - -​ - -Markdown formatting issues - -Claude Code sometimes generates markdown files with missing language tags on code fences, which can affect syntax highlighting and readability in GitHub, editors, and documentation tools. - -### - -​ - -Missing language tags in code blocks - -If you notice code blocks like this in generated markdown: - - ``` - function example() { - return "hello"; - } - ``` - -Instead of properly tagged blocks like: - - ```javascript - function example() { - return "hello"; - } - ``` - -**Solutions:** - - 1. **Ask Claude to add language tags** : request “Add appropriate language tags to all code blocks in this markdown file.” - 2. **Use post-processing hooks** : set up automatic formatting hooks to detect and add missing language tags. See [Auto-format code after edits](</docs/en/hooks-guide#auto-format-code-after-edits>) for an example of a PostToolUse formatting hook. - 3. **Manual verification** : after generating markdown files, review them for proper code block formatting and request corrections if needed. - -### - -​ - -Inconsistent spacing and formatting - -If generated markdown has excessive blank lines or inconsistent spacing: **Solutions:** - - 1. **Request formatting corrections** : ask Claude to “Fix spacing and formatting issues in this markdown file.” - 2. **Use formatting tools** : set up hooks to run markdown formatters like `prettier` or custom formatting scripts on generated markdown files. - 3. **Specify formatting preferences** : include formatting requirements in your prompts or project [memory](</docs/en/memory>) files. - -### - -​ - -Reduce markdown formatting issues - -To minimize formatting issues: - - * **Be explicit in requests** : ask for “properly formatted markdown with language-tagged code blocks” - * **Use project conventions** : document your preferred markdown style in [`CLAUDE.md`](</docs/en/memory>) - * **Set up validation hooks** : use post-processing hooks to automatically verify and fix common formatting issues - -## - -​ - Get more help If you’re experiencing issues not covered here: - 1. See the [Error reference](</docs/en/errors>) for `API Error: 5xx`, `529 Overloaded`, `429`, and request validation errors that appear during a session + 1. Run `/doctor` to check installation health, settings validity, MCP configuration, and context usage in one pass 2. Use the `/feedback` command within Claude Code to report problems directly to Anthropic 3. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues - 4. Run `/doctor` to diagnose issues. It checks: - * Installation type, version, and search functionality - * Auto-update status and available versions - * Invalid settings files (malformed JSON, incorrect types) - * MCP server configuration errors, including the same server name defined in multiple scopes with different endpoints - * Keybinding configuration problems - * Context usage warnings (large CLAUDE.md files, high MCP token usage, unreachable permission rules) - * Plugin and agent loading errors - 5. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation + 4. Ask Claude directly about its capabilities and features. Claude has built-in access to its documentation.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -18,7 +18,7 @@ `Failed to fetch version` or can’t reach download server| Check network and proxy settings `irm is not recognized` or `&& is not valid`| Use the right command for your shell `'bash' is not recognized as the name of a cmdlet`| Use the Windows installer command -`Claude Code on Windows requires git-bash`| Install or configure Git Bash +`Claude Code on Windows requires either Git for Windows (for bash) or PowerShell`| Install a shell `Claude Code does not support 32-bit Windows`| Open Windows PowerShell, not the x86 entry `Error loading shared library`| Wrong binary variant for your system `Illegal instruction` on Linux| Architecture mismatch @@ -386,9 +386,14 @@ ​ -Windows: Claude Code on Windows requires git-bash - -Claude Code on native Windows needs [Git for Windows](<https://git-scm.com/downloads/win>), which includes Git Bash. **If Git is not installed** , download and install it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. **If Git is already installed** but Claude Code still can’t find it, set the path in your [settings.json file](</docs/en/settings>): +Windows: “Claude Code on Windows requires either Git for Windows (for bash) or PowerShell” + +Claude Code on native Windows needs at least one shell: either [Git for Windows](<https://git-scm.com/downloads/win>) for Bash, or PowerShell. When neither is found, this error appears at startup. If only PowerShell is found, Claude Code uses the PowerShell tool instead of Bash. **If neither is installed** , install one: + + * Git for Windows: download from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. + * PowerShell 7: download from [aka.ms/powershell](<https://aka.ms/powershell>). + +**If Git is already installed** but Claude Code can’t find it, set the path in your [settings.json file](</docs/en/settings>): { "env": { @@ -442,16 +447,11 @@ bash: line 142: 2238232 Illegal instruction "$binary_path" install ${TARGET:+"$TARGET"} -**Solutions:** - - 1. **Verify your architecture** : - - uname -m - -`x86_64` means 64-bit Intel/AMD, `aarch64` means ARM64. If the binary doesn’t match, [file a GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output. - 2. **Try an alternative install method** while the architecture issue is resolved: - - brew install --cask claude-code +**Verify your architecture** : + + uname -m + +`x86_64` means 64-bit Intel/AMD, `aarch64` means ARM64. If the binary doesn’t match, [file a GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output. Alternative install methods download the same architecture-specific binary and won’t resolve this error. ### @@ -473,10 +473,7 @@ **Solutions:** 1. **Check your macOS version** : Claude Code requires macOS 13.0 or later. Open the Apple menu and select About This Mac to check your version. - 2. **Update macOS** if you’re on an older version. The binary uses load commands that older macOS versions don’t support. - 3. **Try Homebrew** as an alternative install method: - - brew install --cask claude-code + 2. **Update macOS** if you’re on an older version. The binary uses load commands and system libraries that older macOS versions don’t support. Alternative install methods like Homebrew download the same binary and won’t resolve this error. ###
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -43,13 +43,13 @@ Check network connectivity -The installer downloads from `storage.googleapis.com`. Verify you can reach it: - - curl -sI https://storage.googleapis.com +The installer downloads from `downloads.claude.ai`. Verify you can reach it: + + curl -sI https://downloads.claude.ai If this fails, your network may be blocking the connection. Common causes: - * Corporate firewalls or proxies blocking Google Cloud Storage + * Corporate firewalls or proxies blocking `downloads.claude.ai` * Regional network restrictions: try a VPN or alternative network * TLS/SSL issues: update your system’s CA certificates, or check if `HTTPS_PROXY` is configured @@ -235,9 +235,9 @@ The `curl ... | bash` command downloads the script and passes it directly to Bash for execution using a pipe (`|`). This error means the connection broke before the script finished downloading. Common causes include network interruptions, the download being blocked mid-stream, or system resource limits. **Solutions:** - 1. **Check network stability** : Claude Code binaries are hosted on Google Cloud Storage. Test that you can reach it: - - curl -fsSL https://storage.googleapis.com -o /dev/null + 1. **Check network stability** : Claude Code binaries are hosted at `downloads.claude.ai`. Test that you can reach it: + + curl -fsSL https://downloads.claude.ai -o /dev/null If the command completes silently, your connection is fine and the issue is likely intermittent. Retry the install command. If you see an error, your network may be blocking the download. 2. **Try an alternative install method** : On macOS or Linux: @@ -284,13 +284,13 @@ ​ -`Failed to fetch version from storage.googleapis.com` - -The installer couldn’t reach the download server. This typically means `storage.googleapis.com` is blocked on your network. **Solutions:** +`Failed to fetch version from downloads.claude.ai` + +The installer couldn’t reach the download server. This typically means `downloads.claude.ai` is blocked on your network. **Solutions:** 1. **Test connectivity directly** : - curl -sI https://storage.googleapis.com + curl -sI https://downloads.claude.ai 2. **If behind a proxy** , set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](</docs/en/network-config#proxy-configuration>) for details. @@ -427,7 +427,7 @@ ldd /bin/ls | head -1 If it shows `linux-vdso.so` or references to `/lib/x86_64-linux-gnu/`, you’re on glibc. If it shows `musl`, you’re on musl. - 2. **If you’re on glibc but got the musl binary** , remove the installation and reinstall. You can also manually download the correct binary from the GCS bucket at `https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{VERSION}/manifest.json`. File a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output of `ldd /bin/ls` and `ls /lib/libc.musl*`. + 2. **If you’re on glibc but got the musl binary** , remove the installation and reinstall. You can also manually download the correct binary using the manifest at `https://downloads.claude.ai/claude-code-releases/{VERSION}/manifest.json`. File a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output of `ldd /bin/ls` and `ls /lib/libc.musl*`. 3. **If you’re actually on musl** (Alpine Linux), install the required packages: apk add libgcc libstdc++ ripgrep
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -539,6 +539,20 @@ curl -fsSL https://claude.ai/install.sh | bash +### + +​ + +Native binary not found after npm install + +The `@anthropic-ai/claude-code` npm package pulls in the native binary through a per-platform optional dependency such as `@anthropic-ai/claude-code-darwin-arm64`. If running `claude` after install prints `Could not find native binary package "@anthropic-ai/claude-code-<platform>"`, check the following causes: + + * **Optional dependencies are disabled.** Remove `--omit=optional` from your npm install command, `--no-optional` from pnpm, or `--ignore-optional` from yarn, and check that `.npmrc` does not set `optional=false`. Then reinstall. The native binary is delivered only as an optional dependency, so there is no JavaScript fallback if it is skipped. + * **Unsupported platform.** Prebuilt binaries are published for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-x64-musl`, `linux-arm64-musl`, `win32-x64`, and `win32-arm64`. Claude Code does not ship a binary for other platforms; see the [system requirements](</docs/en/setup#system-requirements>). + * **Corporate npm mirror is missing the platform packages.** Ensure your registry mirrors all eight `@anthropic-ai/claude-code-*` platform packages in addition to the meta package. + +Installing with `--ignore-scripts` does not trigger this error. The postinstall step that links the binary into place is skipped, so Claude Code falls back to a wrapper that locates and spawns the platform binary on each launch. This works but starts more slowly; reinstall with scripts enabled for direct execution. + ## ​
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -27,6 +27,7 @@ `App unavailable in region`| Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). `unable to get local issuer certificate`| Configure corporate CA certificates `OAuth error` or `403 Forbidden`| Fix authentication +`API Error: 500`, `529 Overloaded`, `429`, or other 4xx and 5xx errors not listed above| See the [Error reference](</docs/en/errors>) If your issue isn’t listed, work through these diagnostic steps. @@ -706,6 +707,8 @@ 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file +If memory usage stays high after these steps, run `/heapdump` to write a JavaScript heap snapshot and a memory breakdown to `~/Desktop`. The breakdown shows resident set size, JS heap, array buffers, and unaccounted native memory, which helps identify whether the growth is in JavaScript objects or in native code. Open the `.heapsnapshot` file in Chrome DevTools under Memory → Load to inspect retainers. Attach both files when reporting a memory issue on [GitHub](<https://github.com/anthropics/claude-code/issues>). + ### ​ @@ -916,14 +919,15 @@ If you’re experiencing issues not covered here: - 1. Use the `/feedback` command within Claude Code to report problems directly to Anthropic - 2. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues - 3. Run `/doctor` to diagnose issues. It checks: + 1. See the [Error reference](</docs/en/errors>) for `API Error: 5xx`, `529 Overloaded`, `429`, and request validation errors that appear during a session + 2. Use the `/feedback` command within Claude Code to report problems directly to Anthropic + 3. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues + 4. Run `/doctor` to diagnose issues. It checks: * Installation type, version, and search functionality * Auto-update status and available versions * Invalid settings files (malformed JSON, incorrect types) - * MCP server configuration errors + * MCP server configuration errors, including the same server name defined in multiple scopes with different endpoints * Keybinding configuration problems * Context usage warnings (large CLAUDE.md files, high MCP token usage, unreachable permission rules) * Plugin and agent loading errors - 4. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation + 5. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation
modified
Show diff (104 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -17,10 +17,12 @@ `TLS connect error` or `SSL/TLS secure channel`| Update CA certificates `Failed to fetch version` or can’t reach download server| Check network and proxy settings `irm is not recognized` or `&& is not valid`| Use the right command for your shell +`'bash' is not recognized as the name of a cmdlet`| Use the Windows installer command `Claude Code on Windows requires git-bash`| Install or configure Git Bash +`Claude Code does not support 32-bit Windows`| Open Windows PowerShell, not the x86 entry `Error loading shared library`| Wrong binary variant for your system `Illegal instruction` on Linux| Architecture mismatch -`dyld: cannot load` or `Abort trap` on macOS| Binary incompatibility +`dyld: cannot load`, `dyld: Symbol not found`, or `Abort trap` on macOS| Binary incompatibility `Invoke-Expression: Missing argument in parameter list`| Install script returns HTML `App unavailable in region`| Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). `unable to get local issuer certificate`| Configure corporate CA certificates @@ -306,9 +308,9 @@ ​ -Windows: `irm` or `&&` not recognized - -If you see `'irm' is not recognized` or `The token '&&' is not valid`, you’re running the wrong command for your shell. +Windows: wrong install command + +If you see `'irm' is not recognized`, `The token '&&' is not valid`, or `'bash' is not recognized as the name of a cmdlet`, you copied the install command for a different shell or operating system. * **`irm` not recognized**: you’re in CMD, not PowerShell. You have two options: Open PowerShell by searching for “PowerShell” in the Start menu, then run the original install command: @@ -319,6 +321,10 @@ curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd * **`&&` not valid**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: + + irm https://claude.ai/install.ps1 | iex + + * **`bash` not recognized**: you ran the macOS/Linux installer on Windows. Use the PowerShell installer instead: irm https://claude.ai/install.ps1 | iex @@ -379,7 +385,7 @@ ​ -Windows: “Claude Code on Windows requires git-bash” +Windows: Claude Code on Windows requires git-bash Claude Code on native Windows needs [Git for Windows](<https://git-scm.com/downloads/win>), which includes Git Bash. **If Git is not installed** , download and install it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. **If Git is already installed** but Claude Code still can’t find it, set the path in your [settings.json file](</docs/en/settings>): @@ -395,6 +401,18 @@ ​ +Windows: Claude Code does not support 32-bit Windows + +Windows includes two PowerShell entries in the Start menu: `Windows PowerShell` and `Windows PowerShell (x86)`. The x86 entry runs as a 32-bit process and triggers this error even on a 64-bit machine. To check which case you’re in, run this in the same window that produced the error: + + [Environment]::Is64BitOperatingSystem + +If this prints `True`, your operating system is fine. Close the window, open `Windows PowerShell` without the x86 suffix, and run the install command again. If this prints `False`, you are on a 32-bit edition of Windows. Claude Code requires a 64-bit operating system. See the [system requirements](</docs/en/setup#system-requirements>). + +### + +​ + Linux: wrong binary variant installed (musl/glibc mismatch) If you see errors about missing shared libraries like `libstdc++.so.6` or `libgcc_s.so.1` after installation, the installer may have downloaded the wrong binary variant for your system. @@ -440,10 +458,16 @@ `dyld: cannot load` on macOS -If you see `dyld: cannot load` or `Abort trap: 6` during installation, the binary is incompatible with your macOS version or hardware. +If you see `dyld: cannot load`, `dyld: Symbol not found`, or `Abort trap: 6` during installation, the binary is incompatible with your macOS version or hardware. dyld: cannot load 'claude-2.1.42-darwin-x64' (load command 0x80000034 is unknown) Abort trap: 6 + +A `Symbol not found` error that references `libicucore` also indicates your macOS version is older than the binary supports: + + dyld: Symbol not found: _ubrk_clone + Referenced from: claude-darwin-x64 (which was built for Mac OS X 13.0) + Expected in: /usr/lib/libicucore.A.dylib **Solutions:** @@ -594,7 +618,7 @@ ​ -”This organization has been disabled” with an active subscription +This organization has been disabled with an active subscription If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode (`-p`), the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile: @@ -620,7 +644,7 @@ ​ -”Not logged in” or token expired +Not logged in or token expired If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. On macOS, login can also fail when the Keychain is locked or its password is out of sync with your account password, which prevents Claude Code from saving credentials. Run `claude doctor` to check Keychain access. To unlock the Keychain manually, run `security unlock-keychain ~/Library/Keychains/login.keychain-db`. If unlocking doesn’t help, open Keychain Access, select the `login` keychain, and choose Edit > Change Password for Keychain “login” to resync it with your account password.
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -271,7 +271,7 @@ export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. - 4. **On Windows, bypass certificate revocation checks** if you see `CRYPT_E_REVOCATION_OFFLINE (0x80092013)`. This means curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. Add `--ssl-revoke-best-effort` to the install command: + 4. **On Windows, bypass certificate revocation checks** if you see `CRYPT_E_NO_REVOCATION_CHECK (0x80092012)` or `CRYPT_E_REVOCATION_OFFLINE (0x80092013)`. These mean curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. Add `--ssl-revoke-best-effort` to the install command: curl --ssl-revoke-best-effort -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -134,7 +134,7 @@ npm uninstall -g @anthropic-ai/claude-code -Remove a Homebrew install on macOS: +Remove a Homebrew install on macOS (use `claude-code@latest` if you installed that cask): brew uninstall --cask claude-code
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -271,6 +271,11 @@ export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. + 4. **On Windows, bypass certificate revocation checks** if you see `CRYPT_E_REVOCATION_OFFLINE (0x80092013)`. This means curl reached the server but your network blocks the certificate revocation lookup, which is common behind corporate firewalls. Add `--ssl-revoke-best-effort` to the install command: + + curl --ssl-revoke-best-effort -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd + +Alternatively, install with `winget install Anthropic.ClaudeCode`, which avoids curl entirely. ### @@ -676,6 +681,19 @@ 1. Use `/compact` regularly to reduce context size 2. Close and restart Claude Code between major tasks 3. Consider adding large build directories to your `.gitignore` file + +### + +​ + +Auto-compaction stops with a thrashing error + +If you see `Autocompact is thrashing: the context refilled to the limit...`, automatic compaction succeeded but a file or tool output immediately refilled the context window several times in a row. Claude Code stops retrying to avoid wasting API calls on a loop that isn’t making progress. To recover: + + 1. Ask Claude to read the oversized file in smaller chunks, such as a specific line range or function, instead of the whole file + 2. Run `/compact` with a focus that drops the large output, for example `/compact keep only the plan and the diff` + 3. Move the large-file work to a [subagent](</docs/en/sub-agents>) so it runs in a separate context window + 4. Run `/clear` if the earlier conversation is no longer needed ###
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -567,6 +567,28 @@ ​ +Model not found or not accessible + +If you see `There's an issue with the selected model (...). It may not exist or you may not have access to it`, the API rejected the configured model name. Common causes: + + * A typo in the model name passed to `--model` + * A stale or deprecated model ID saved in your settings + * An API key without access to that model on your current usage tier + +Check where the model is set, in [priority order](</docs/en/model-config#setting-your-model>): + + * The `--model` flag + * The `ANTHROPIC_MODEL` environment variable + * The `model` field in `.claude/settings.local.json` + * The `model` field in your project’s `.claude/settings.json` + * The `model` field in `~/.claude/settings.json` + +To clear a stale value, remove the `model` field from your settings or unset `ANTHROPIC_MODEL`, and Claude Code will fall back to the default model for your account. To browse models available to your account, start `claude` interactively and run `/model` to open the picker. For Vertex AI deployments, see [the Vertex AI troubleshooting section](</docs/en/google-vertex-ai#troubleshooting>). + +### + +​ + ”This organization has been disabled” with an active subscription If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode (`-p`), the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile: @@ -595,7 +617,7 @@ ”Not logged in” or token expired -If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. +If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. On macOS, login can also fail when the Keychain is locked or its password is out of sync with your account password, which prevents Claude Code from saving credentials. Run `claude doctor` to check Keychain access. To unlock the Keychain manually, run `security unlock-keychain ~/Library/Keychains/login.keychain-db`. If unlocking doesn’t help, open Keychain Access, select the `login` keychain, and choose Edit > Change Password for Keychain “login” to resync it with your account password. ##
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -497,7 +497,7 @@ sudo dnf install bubblewrap socat -WSL1 does not support sandboxing. If you see “Sandboxing requires WSL2”, you need to upgrade to WSL2 or run Claude Code without sandboxing. +WSL1 does not support sandboxing. If you see “Sandboxing requires WSL2”, you need to upgrade to WSL2 or run Claude Code without sandboxing. Sandboxed commands cannot launch Windows binaries such as `cmd.exe`, `powershell.exe`, or executables under `/mnt/c/`. WSL hands these off to the Windows host over a Unix socket, which the sandbox blocks. If a command needs to invoke a Windows binary, add it to [`excludedCommands`](</docs/en/settings#sandbox-settings>) so it runs outside the sandbox. ###
modified
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -4,7 +4,7 @@ Troubleshoot installation issues -If you’d rather skip the terminal entirely, the [Claude Code Desktop app](</docs/en/desktop-quickstart>) lets you install and use Claude Code through a graphical interface. Download it for [macOS](<https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs>) or [Windows](<https://claude.ai/api/desktop/win32/x64/exe/latest/redirect?utm_source=claude_code&utm_medium=docs>) and start coding without any command-line setup. +If you’d rather skip the terminal entirely, the [Claude Code Desktop app](</docs/en/desktop-quickstart>) lets you install and use Claude Code through a graphical interface. Download it for [macOS](<https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs>) or [Windows](<https://claude.com/download?utm_source=claude_code&utm_medium=docs>) and start coding without any command-line setup. Find the error message or symptom you’re seeing: @@ -487,7 +487,7 @@ WSL2 sandbox setup -[Sandboxing](</docs/en/sandboxing>) is supported on WSL2 but requires installing additional packages. If you see an error like “Sandbox requires socat and bubblewrap” when running `/sandbox`, install the dependencies: +[Sandboxing](</docs/en/sandboxing>) is supported on WSL2 but requires installing additional packages. If you see an error about missing `bubblewrap` or `socat` when running `/sandbox`, install the dependencies: * Ubuntu/Debian @@ -804,7 +804,7 @@ function example() { return "hello"; } - ```text + ``` Instead of properly tagged blocks like: @@ -812,7 +812,7 @@ function example() { return "hello"; } - ```text + ``` **Solutions:**
modified
Show diff (796 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -42,12 +42,6 @@ The installer downloads from `storage.googleapis.com`. Verify you can reach it: -Report incorrect code - -Copy - -Ask AI - curl -sI https://storage.googleapis.com If this fails, your network may be blocking the connection. Common causes: @@ -58,12 +52,6 @@ If you’re behind a corporate proxy, set `HTTPS_PROXY` and `HTTP_PROXY` to your proxy’s address before installing. Ask your IT team for the proxy URL if you don’t know it, or check your browser’s proxy settings. This example sets both proxy variables, then runs the installer through your proxy: -Report incorrect code - -Copy - -Ask AI - export HTTP_PROXY=http://proxy.example.com:8080 export HTTPS_PROXY=http://proxy.example.com:8080 curl -fsSL https://claude.ai/install.sh | bash @@ -82,21 +70,9 @@ * Windows CMD -Report incorrect code - -Copy - -Ask AI - echo $PATH | tr ':' '\n' | grep local/bin If there’s no output, the directory is missing. Add it to your shell configuration: - -Report incorrect code - -Copy - -Ask AI # Zsh (macOS default) echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc @@ -108,59 +84,23 @@ Alternatively, close and reopen your terminal.Verify the fix worked: -Report incorrect code - -Copy - -Ask AI - claude --version -Report incorrect code - -Copy - -Ask AI - $env:PATH -split ';' | Select-String 'local\\bin' If there’s no output, add the install directory to your User PATH: - -Report incorrect code - -Copy - -Ask AI $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User') Restart your terminal for the change to take effect.Verify the fix worked: -Report incorrect code - -Copy - -Ask AI - claude --version -Report incorrect code - -Copy - -Ask AI - echo %PATH% | findstr /i "local\bin" If there’s no output, open System Settings, go to Environment Variables, and add `%USERPROFILE%\.local\bin` to your User PATH variable. Restart your terminal.Verify the fix worked: -Report incorrect code - -Copy - -Ask AI - claude --version ### @@ -177,67 +117,25 @@ List all `claude` binaries found in your PATH: -Report incorrect code - -Copy - -Ask AI - which -a claude Check whether the native installer and npm versions are present: -Report incorrect code - -Copy - -Ask AI - ls -la ~/.local/bin/claude -Report incorrect code - -Copy - -Ask AI - ls -la ~/.claude/local/ -Report incorrect code - -Copy - -Ask AI - npm -g ls @anthropic-ai/claude-code 2>/dev/null - -Report incorrect code - -Copy - -Ask AI where.exe claude Test-Path "$env:LOCALAPPDATA\Claude Code\claude.exe" If you find multiple installations, keep only one. The native install at `~/.local/bin/claude` is recommended. Remove any extra installations: Uninstall an npm global install: -Report incorrect code - -Copy - -Ask AI - npm uninstall -g @anthropic-ai/claude-code Remove a Homebrew install on macOS: -Report incorrect code - -Copy - -Ask AI - brew uninstall --cask claude-code ### @@ -247,24 +145,12 @@ Check directory permissions The installer needs write access to `~/.local/bin/` and `~/.claude/`. If installation fails with permission errors, check whether these directories are writable: - -Report incorrect code - -Copy - -Ask AI test -w ~/.local/bin && echo "writable" || echo "not writable" test -w ~/.claude && echo "writable" || echo "not writable" If either directory isn’t writable, create the install directory and set your user as the owner: -Report incorrect code - -Copy - -Ask AI - sudo mkdir -p ~/.local/bin sudo chown -R $(whoami) ~/.local @@ -276,32 +162,14 @@ If `claude` is installed but crashes or hangs on startup, run these checks to narrow down the cause. Confirm the binary exists and is executable: -Report incorrect code - -Copy - -Ask AI - ls -la $(which claude) On Linux, check for missing shared libraries. If `ldd` shows missing libraries, you may need to install system packages. On Alpine Linux and other musl-based distributions, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>). -Report incorrect code - -Copy - -Ask AI - ldd $(which claude) | grep "not found" Run a quick sanity check that the binary can execute: -Report incorrect code - -Copy - -Ask AI - claude --version ## @@ -319,45 +187,21 @@ Install script returns HTML instead of a shell script When running the install command, you may see one of these errors: - -Report incorrect code - -Copy - -Ask AI bash: line 1: syntax error near unexpected token `<' bash: line 1: `<!DOCTYPE html>' On PowerShell, the same problem appears as: -Report incorrect code - -Copy - -Ask AI - Invoke-Expression: Missing argument in parameter list. This means the install URL returned an HTML page instead of the install script. If the HTML page says “App unavailable in region,” Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). Otherwise, this can happen due to network issues, regional routing, or a temporary service disruption. **Solutions:** 1. **Use an alternative install method** : On macOS or Linux, install via Homebrew: -Report incorrect code - -Copy - -Ask AI - brew install --cask claude-code On Windows, install via WinGet: - -Report incorrect code - -Copy - -Ask AI winget install Anthropic.ClaudeCode @@ -390,33 +234,15 @@ 1. **Check network stability** : Claude Code binaries are hosted on Google Cloud Storage. Test that you can reach it: -Report incorrect code - -Copy - -Ask AI - curl -fsSL https://storage.googleapis.com -o /dev/null If the command completes silently, your connection is fine and the issue is likely intermittent. Retry the install command. If you see an error, your network may be blocking the download. 2. **Try an alternative install method** : On macOS or Linux: -Report incorrect code - -Copy - -Ask AI - brew install --cask claude-code On Windows: -Report incorrect code - -Copy - -Ask AI - winget install Anthropic.ClaudeCode ### @@ -429,43 +255,19 @@ 1. **Update your system CA certificates** : On Ubuntu/Debian: -Report incorrect code - -Copy - -Ask AI - sudo apt-get update && sudo apt-get install ca-certificates On macOS via Homebrew: -Report incorrect code - -Copy - -Ask AI - brew install ca-certificates 2. **On Windows, enable TLS 1.2** in PowerShell before running the installer: - -Report incorrect code - -Copy - -Ask AI [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 irm https://claude.ai/install.ps1 | iex 3. **Check for proxy or firewall interference** : corporate proxies that perform TLS inspection can cause these errors, including `unable to get local issuer certificate`. Set `NODE_EXTRA_CA_CERTS` to your corporate CA certificate bundle: -Report incorrect code - -Copy - -Ask AI - export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. @@ -480,43 +282,19 @@ 1. **Test connectivity directly** : -Report incorrect code - -Copy - -Ask AI - curl -sI https://storage.googleapis.com 2. **If behind a proxy** , set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](</docs/en/network-config#proxy-configuration>) for details. - -Report incorrect code - -Copy - -Ask AI export HTTPS_PROXY=http://proxy.example.com:8080 curl -fsSL https://claude.ai/install.sh | bash 3. **If on a restricted network** , try a different network or VPN, or use an alternative install method: On macOS or Linux: -Report incorrect code - -Copy - -Ask AI - brew install --cask claude-code On Windows: -Report incorrect code - -Copy - -Ask AI - winget install Anthropic.ClaudeCode ### @@ -529,32 +307,14 @@ * **`irm` not recognized**: you’re in CMD, not PowerShell. You have two options: Open PowerShell by searching for “PowerShell” in the Start menu, then run the original install command: -Report incorrect code - -Copy - -Ask AI - irm https://claude.ai/install.ps1 | iex Or stay in CMD and use the CMD installer instead: -Report incorrect code - -Copy - -Ask AI - curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd * **`&&` not valid**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: -Report incorrect code - -Copy - -Ask AI - irm https://claude.ai/install.ps1 | iex ### @@ -564,12 +324,6 @@ Install killed on low-memory Linux servers If you see `Killed` during installation on a VPS or cloud instance: - -Report incorrect code - -Copy - -Ask AI Setting up Claude Code... Installing Claude Code native build latest... @@ -578,12 +332,6 @@ The Linux OOM killer terminated the process because the system ran out of memory. Claude Code requires at least 4 GB of available RAM. **Solutions:** 1. **Add swap space** if your server has limited RAM. Swap uses disk space as overflow memory, letting the install complete even with low physical RAM. Create a 2 GB swap file and enable it: - -Report incorrect code - -Copy - -Ask AI sudo fallocate -l 2G /swapfile sudo chmod 600 /swapfile @@ -592,12 +340,6 @@ Then retry the installation: -Report incorrect code - -Copy - -Ask AI - curl -fsSL https://claude.ai/install.sh | bash 2. **Close other processes** to free memory before installing. @@ -613,23 +355,11 @@ 1. **Set a working directory** before running the installer. When run from `/`, the installer scans the entire filesystem, which causes excessive memory usage. Setting `WORKDIR` limits the scan to a small directory: -Report incorrect code - -Copy - -Ask AI - WORKDIR /tmp RUN curl -fsSL https://claude.ai/install.sh | bash 2. **Increase Docker memory limits** if using Docker Desktop: -Report incorrect code - -Copy - -Ask AI - docker build --memory=4g . ### @@ -647,12 +377,6 @@ Windows: “Claude Code on Windows requires git-bash” Claude Code on native Windows needs [Git for Windows](<https://git-scm.com/downloads/win>), which includes Git Bash. **If Git is not installed** , download and install it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. **If Git is already installed** but Claude Code still can’t find it, set the path in your [settings.json file](</docs/en/settings>): - -Report incorrect code - -Copy - -Ask AI { "env": { @@ -670,23 +394,11 @@ If you see errors about missing shared libraries like `libstdc++.so.6` or `libgcc_s.so.1` after installation, the installer may have downloaded the wrong binary variant for your system. -Report incorrect code - -Copy - -Ask AI - Error loading shared library libstdc++.so.6: No such file or directory This can happen on glibc-based systems that have musl cross-compilation packages installed, causing the installer to misdetect the system as musl. **Solutions:** 1. **Check which libc your system uses** : - -Report incorrect code - -Copy - -Ask AI ldd /bin/ls | head -1 @@ -694,12 +406,6 @@ 2. **If you’re on glibc but got the musl binary** , remove the installation and reinstall. You can also manually download the correct binary from the GCS bucket at `https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{VERSION}/manifest.json`. File a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output of `ldd /bin/ls` and `ls /lib/libc.musl*`. 3. **If you’re actually on musl** (Alpine Linux), install the required packages: -Report incorrect code - -Copy - -Ask AI - apk add libgcc libstdc++ ripgrep ### @@ -710,35 +416,17 @@ If the installer prints `Illegal instruction` instead of the OOM `Killed` message, the downloaded binary doesn’t match your CPU architecture. This commonly happens on ARM servers that receive an x86 binary, or on older CPUs that lack required instruction sets. -Report incorrect code - -Copy - -Ask AI - bash: line 142: 2238232 Illegal instruction "$binary_path" install ${TARGET:+"$TARGET"} **Solutions:** 1. **Verify your architecture** : - -Report incorrect code - -Copy - -Ask AI uname -m `x86_64` means 64-bit Intel/AMD, `aarch64` means ARM64. If the binary doesn’t match, [file a GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output. 2. **Try an alternative install method** while the architecture issue is resolved: -Report incorrect code - -Copy - -Ask AI - brew install --cask claude-code ### @@ -748,12 +436,6 @@ `dyld: cannot load` on macOS If you see `dyld: cannot load` or `Abort trap: 6` during installation, the binary is incompatible with your macOS version or hardware. - -Report incorrect code - -Copy - -Ask AI dyld: cannot load 'claude-2.1.42-darwin-x64' (load command 0x80000034 is unknown) Abort trap: 6 @@ -764,12 +446,6 @@ 2. **Update macOS** if you’re on an older version. The binary uses load commands that older macOS versions don’t support. 3. **Try Homebrew** as an alternative install method: -Report incorrect code - -Copy - -Ask AI - brew install --cask claude-code ### @@ -789,12 +465,6 @@ * Experiencing broken functionality after switching Node versions with nvm in WSL To resolve this issue, fix your Linux PATH to ensure the Linux node/npm versions take priority: **Primary solution: Ensure nvm is properly loaded in your shell** The most common cause is that nvm isn’t loaded in non-interactive shells. Add the following to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.): - -Report incorrect code - -Copy - -Ask AI # Load nvm if it exists export NVM_DIR="$HOME/.nvm" @@ -803,22 +473,10 @@ Or run directly in your current session: -Report incorrect code - -Copy - -Ask AI - source ~/.nvm/nvm.sh **Alternative: Adjust PATH order** If nvm is properly loaded but Windows paths still take priority, you can explicitly prepend your Linux paths to PATH in your shell configuration: -Report incorrect code - -Copy - -Ask AI - export PATH="$HOME/.nvm/versions/node/$(node -v)/bin:$PATH" Avoid disabling Windows PATH importing via `appendWindowsPath = false` as this breaks the ability to call Windows executables from WSL. Similarly, avoid uninstalling Node.js from Windows if you use it for Windows development. @@ -835,20 +493,8 @@ * Fedora -Report incorrect code - -Copy - -Ask AI - sudo apt-get install bubblewrap socat -Report incorrect code - -Copy - -Ask AI - sudo dnf install bubblewrap socat WSL1 does not support sandboxing. If you see “Sandboxing requires WSL2”, you need to upgrade to WSL2 or run Claude Code without sandboxing. @@ -860,12 +506,6 @@ Permission errors during installation If the native installer fails with permission errors, the target directory may not be writable. See Check directory permissions. If you previously installed with npm and are hitting npm-specific permission errors, switch to the native installer: - -Report incorrect code - -Copy - -Ask AI curl -fsSL https://claude.ai/install.sh | bash @@ -931,12 +571,6 @@ If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode (`-p`), the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile: -Report incorrect code - -Copy - -Ask AI - unset ANTHROPIC_API_KEY claude @@ -949,12 +583,6 @@ OAuth login fails in WSL2 Browser-based login in WSL2 may fail if WSL can’t open your Windows browser. Set the `BROWSER` environment variable: - -Report incorrect code - -Copy - -Ask AI export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" claude @@ -997,12 +625,6 @@ To reset Claude Code to default settings, you can remove the configuration files: -Report incorrect code - -Copy - -Ask AI - # Reset all user settings and state rm ~/.claude.json rm -rf ~/.claude/ @@ -1052,12 +674,6 @@ If Search tool, `@file` mentions, custom agents, and custom skills aren’t working, install system `ripgrep`: -Report incorrect code - -Copy - -Ask AI - # macOS (Homebrew) brew install ripgrep @@ -1117,35 +733,17 @@ 1. Find your WSL2 IP address: -Report incorrect code - -Copy - -Ask AI - wsl hostname -I # Example output: 172.21.123.45 2. Open PowerShell as Administrator and create a firewall rule: -Report incorrect code - -Copy - -Ask AI - New-NetFirewallRule -DisplayName "Allow WSL2 Internal Traffic" -Direction Inbound -Protocol TCP -Action Allow -RemoteAddress 172.21.0.0/16 -LocalAddress 172.21.0.0/16 Adjust the IP range based on your WSL2 subnet from step 1. 3. Restart both your IDE and Claude Code **Option 2: Switch to mirrored networking** Add to `.wslconfig` in your Windows user directory: - -Report incorrect code - -Copy - -Ask AI [wsl2] networkingMode=mirrored @@ -1202,12 +800,6 @@ If you notice code blocks like this in generated markdown: -Report incorrect code - -Copy - -Ask AI - ``` function example() { return "hello"; @@ -1215,12 +807,6 @@ ```text Instead of properly tagged blocks like: - -Report incorrect code - -Copy - -Ask AI ```javascript function example() {
added
Show diff (1282 lines)
--- a/troubleshooting.md +++ b/troubleshooting.md @@ -0,0 +1,1279 @@ +## + +​ + +Troubleshoot installation issues + +If you’d rather skip the terminal entirely, the [Claude Code Desktop app](</docs/en/desktop-quickstart>) lets you install and use Claude Code through a graphical interface. Download it for [macOS](<https://claude.ai/api/desktop/darwin/universal/dmg/latest/redirect?utm_source=claude_code&utm_medium=docs>) or [Windows](<https://claude.ai/api/desktop/win32/x64/exe/latest/redirect?utm_source=claude_code&utm_medium=docs>) and start coding without any command-line setup. + +Find the error message or symptom you’re seeing: + +What you see| Solution +---|--- +`command not found: claude` or `'claude' is not recognized`| Fix your PATH +`syntax error near unexpected token '<'`| Install script returns HTML +`curl: (56) Failure writing output to destination`| Download script first, then run it +`Killed` during install on Linux| Add swap space for low-memory servers +`TLS connect error` or `SSL/TLS secure channel`| Update CA certificates +`Failed to fetch version` or can’t reach download server| Check network and proxy settings +`irm is not recognized` or `&& is not valid`| Use the right command for your shell +`Claude Code on Windows requires git-bash`| Install or configure Git Bash +`Error loading shared library`| Wrong binary variant for your system +`Illegal instruction` on Linux| Architecture mismatch +`dyld: cannot load` or `Abort trap` on macOS| Binary incompatibility +`Invoke-Expression: Missing argument in parameter list`| Install script returns HTML +`App unavailable in region`| Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). +`unable to get local issuer certificate`| Configure corporate CA certificates +`OAuth error` or `403 Forbidden`| Fix authentication + +If your issue isn’t listed, work through these diagnostic steps. + +## + +​ + +Debug installation problems + +### + +​ + +Check network connectivity + +The installer downloads from `storage.googleapis.com`. Verify you can reach it: + +Report incorrect code + +Copy + +Ask AI + + curl -sI https://storage.googleapis.com + +If this fails, your network may be blocking the connection. Common causes: + + * Corporate firewalls or proxies blocking Google Cloud Storage + * Regional network restrictions: try a VPN or alternative network + * TLS/SSL issues: update your system’s CA certificates, or check if `HTTPS_PROXY` is configured + +If you’re behind a corporate proxy, set `HTTPS_PROXY` and `HTTP_PROXY` to your proxy’s address before installing. Ask your IT team for the proxy URL if you don’t know it, or check your browser’s proxy settings. This example sets both proxy variables, then runs the installer through your proxy: + +Report incorrect code + +Copy + +Ask AI + + export HTTP_PROXY=http://proxy.example.com:8080 + export HTTPS_PROXY=http://proxy.example.com:8080 + curl -fsSL https://claude.ai/install.sh | bash + +### + +​ + +Verify your PATH + +If installation succeeded but you get a `command not found` or `not recognized` error when running `claude`, the install directory isn’t in your PATH. Your shell searches for programs in directories listed in PATH, and the installer places `claude` at `~/.local/bin/claude` on macOS/Linux or `%USERPROFILE%\.local\bin\claude.exe` on Windows. Check if the install directory is in your PATH by listing your PATH entries and filtering for `local/bin`: + + * macOS/Linux + + * Windows PowerShell + + * Windows CMD + +Report incorrect code + +Copy + +Ask AI + + echo $PATH | tr ':' '\n' | grep local/bin + +If there’s no output, the directory is missing. Add it to your shell configuration: + +Report incorrect code + +Copy + +Ask AI + + # Zsh (macOS default) + echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc + source ~/.zshrc + + # Bash (Linux default) + echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc + source ~/.bashrc + +Alternatively, close and reopen your terminal.Verify the fix worked: + +Report incorrect code + +Copy + +Ask AI + + claude --version + +Report incorrect code + +Copy + +Ask AI + + $env:PATH -split ';' | Select-String 'local\\bin' + +If there’s no output, add the install directory to your User PATH: + +Report incorrect code + +Copy + +Ask AI + + $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User') + [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User') + +Restart your terminal for the change to take effect.Verify the fix worked: + +Report incorrect code + +Copy + +Ask AI + + claude --version + +Report incorrect code + +Copy + +Ask AI + + echo %PATH% | findstr /i "local\bin" + +If there’s no output, open System Settings, go to Environment Variables, and add `%USERPROFILE%\.local\bin` to your User PATH variable. Restart your terminal.Verify the fix worked: + +Report incorrect code + +Copy + +Ask AI + + claude --version + +### + +​ + +Check for conflicting installations + +Multiple Claude Code installations can cause version mismatches or unexpected behavior. Check what’s installed: + + * macOS/Linux + + * Windows PowerShell + +List all `claude` binaries found in your PATH: + +Report incorrect code + +Copy + +Ask AI + + which -a claude + +Check whether the native installer and npm versions are present: + +Report incorrect code + +Copy + +Ask AI + + ls -la ~/.local/bin/claude + +Report incorrect code + +Copy + +Ask AI + + ls -la ~/.claude/local/ + +Report incorrect code + +Copy + +Ask AI + + npm -g ls @anthropic-ai/claude-code 2>/dev/null + +Report incorrect code + +Copy + +Ask AI + + where.exe claude + Test-Path "$env:LOCALAPPDATA\Claude Code\claude.exe" + +If you find multiple installations, keep only one. The native install at `~/.local/bin/claude` is recommended. Remove any extra installations: Uninstall an npm global install: + +Report incorrect code + +Copy + +Ask AI + + npm uninstall -g @anthropic-ai/claude-code + +Remove a Homebrew install on macOS: + +Report incorrect code + +Copy + +Ask AI + + brew uninstall --cask claude-code + +### + +​ + +Check directory permissions + +The installer needs write access to `~/.local/bin/` and `~/.claude/`. If installation fails with permission errors, check whether these directories are writable: + +Report incorrect code + +Copy + +Ask AI + + test -w ~/.local/bin && echo "writable" || echo "not writable" + test -w ~/.claude && echo "writable" || echo "not writable" + +If either directory isn’t writable, create the install directory and set your user as the owner: + +Report incorrect code + +Copy + +Ask AI + + sudo mkdir -p ~/.local/bin + sudo chown -R $(whoami) ~/.local + +### + +​ + +Verify the binary works + +If `claude` is installed but crashes or hangs on startup, run these checks to narrow down the cause. Confirm the binary exists and is executable: + +Report incorrect code + +Copy + +Ask AI + + ls -la $(which claude) + +On Linux, check for missing shared libraries. If `ldd` shows missing libraries, you may need to install system packages. On Alpine Linux and other musl-based distributions, see [Alpine Linux setup](</docs/en/setup#alpine-linux-and-musl-based-distributions>). + +Report incorrect code + +Copy + +Ask AI + + ldd $(which claude) | grep "not found" + +Run a quick sanity check that the binary can execute: + +Report incorrect code + +Copy + +Ask AI + + claude --version + +## + +​ + +Common installation issues + +These are the most frequently encountered installation problems and their solutions. + +### + +​ + +Install script returns HTML instead of a shell script + +When running the install command, you may see one of these errors: + +Report incorrect code + +Copy + +Ask AI + + bash: line 1: syntax error near unexpected token `<' + bash: line 1: `<!DOCTYPE html>' + +On PowerShell, the same problem appears as: + +Report incorrect code + +Copy + +Ask AI + + Invoke-Expression: Missing argument in parameter list. + +This means the install URL returned an HTML page instead of the install script. If the HTML page says “App unavailable in region,” Claude Code is not available in your country. See [supported countries](<https://www.anthropic.com/supported-countries>). Otherwise, this can happen due to network issues, regional routing, or a temporary service disruption. **Solutions:** + + 1. **Use an alternative install method** : On macOS or Linux, install via Homebrew: + +Report incorrect code + +Copy + +Ask AI + + brew install --cask claude-code + +On Windows, install via WinGet: + +Report incorrect code + +Copy + +Ask AI + + winget install Anthropic.ClaudeCode + + 2. **Retry after a few minutes** : the issue is often temporary. Wait and try the original command again. + +### + +​ + +`command not found: claude` after installation + +The install finished but `claude` doesn’t work. The exact error varies by platform: + +Platform| Error message +---|--- +macOS| `zsh: command not found: claude` +Linux| `bash: claude: command not found` +Windows CMD| `'claude' is not recognized as an internal or external command` +PowerShell| `claude : The term 'claude' is not recognized as the name of a cmdlet` + +This means the install directory isn’t in your shell’s search path. See Verify your PATH for the fix on each platform. + +### + +​ + +`curl: (56) Failure writing output to destination` + +The `curl ... | bash` command downloads the script and passes it directly to Bash for execution using a pipe (`|`). This error means the connection broke before the script finished downloading. Common causes include network interruptions, the download being blocked mid-stream, or system resource limits. **Solutions:** + + 1. **Check network stability** : Claude Code binaries are hosted on Google Cloud Storage. Test that you can reach it: + +Report incorrect code + +Copy + +Ask AI + + curl -fsSL https://storage.googleapis.com -o /dev/null + +If the command completes silently, your connection is fine and the issue is likely intermittent. Retry the install command. If you see an error, your network may be blocking the download. + 2. **Try an alternative install method** : On macOS or Linux: + +Report incorrect code + +Copy + +Ask AI + + brew install --cask claude-code + +On Windows: + +Report incorrect code + +Copy + +Ask AI + + winget install Anthropic.ClaudeCode + +### + +​ + +TLS or SSL connection errors + +Errors like `curl: (35) TLS connect error`, `schannel: next InitializeSecurityContext failed`, or PowerShell’s `Could not establish trust relationship for the SSL/TLS secure channel` indicate TLS handshake failures. **Solutions:** + + 1. **Update your system CA certificates** : On Ubuntu/Debian: + +Report incorrect code + +Copy + +Ask AI + + sudo apt-get update && sudo apt-get install ca-certificates + +On macOS via Homebrew: + +Report incorrect code + +Copy + +Ask AI + + brew install ca-certificates + + 2. **On Windows, enable TLS 1.2** in PowerShell before running the installer: + +Report incorrect code + +Copy + +Ask AI + + [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 + irm https://claude.ai/install.ps1 | iex + + 3. **Check for proxy or firewall interference** : corporate proxies that perform TLS inspection can cause these errors, including `unable to get local issuer certificate`. Set `NODE_EXTRA_CA_CERTS` to your corporate CA certificate bundle: + +Report incorrect code + +Copy + +Ask AI + + export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem + +Ask your IT team for the certificate file if you don’t have it. You can also try on a direct connection to confirm the proxy is the cause. + +### + +​ + +`Failed to fetch version from storage.googleapis.com` + +The installer couldn’t reach the download server. This typically means `storage.googleapis.com` is blocked on your network. **Solutions:** + + 1. **Test connectivity directly** : + +Report incorrect code + +Copy + +Ask AI + + curl -sI https://storage.googleapis.com + + 2. **If behind a proxy** , set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](</docs/en/network-config#proxy-configuration>) for details. + +Report incorrect code + +Copy + +Ask AI + + export HTTPS_PROXY=http://proxy.example.com:8080 + curl -fsSL https://claude.ai/install.sh | bash + + 3. **If on a restricted network** , try a different network or VPN, or use an alternative install method: On macOS or Linux: + +Report incorrect code + +Copy + +Ask AI + + brew install --cask claude-code + +On Windows: + +Report incorrect code + +Copy + +Ask AI + + winget install Anthropic.ClaudeCode + +### + +​ + +Windows: `irm` or `&&` not recognized + +If you see `'irm' is not recognized` or `The token '&&' is not valid`, you’re running the wrong command for your shell. + + * **`irm` not recognized**: you’re in CMD, not PowerShell. You have two options: Open PowerShell by searching for “PowerShell” in the Start menu, then run the original install command: + +Report incorrect code + +Copy + +Ask AI + + irm https://claude.ai/install.ps1 | iex + +Or stay in CMD and use the CMD installer instead: + +Report incorrect code + +Copy + +Ask AI + + curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd + + * **`&&` not valid**: you’re in PowerShell but ran the CMD installer command. Use the PowerShell installer: + +Report incorrect code + +Copy + +Ask AI + + irm https://claude.ai/install.ps1 | iex + +### + +​ + +Install killed on low-memory Linux servers + +If you see `Killed` during installation on a VPS or cloud instance: + +Report incorrect code + +Copy + +Ask AI + + Setting up Claude Code... + Installing Claude Code native build latest... + bash: line 142: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"} + +The Linux OOM killer terminated the process because the system ran out of memory. Claude Code requires at least 4 GB of available RAM. **Solutions:** + + 1. **Add swap space** if your server has limited RAM. Swap uses disk space as overflow memory, letting the install complete even with low physical RAM. Create a 2 GB swap file and enable it: + +Report incorrect code + +Copy + +Ask AI + + sudo fallocate -l 2G /swapfile + sudo chmod 600 /swapfile + sudo mkswap /swapfile + sudo swapon /swapfile + +Then retry the installation: + +Report incorrect code + +Copy + +Ask AI + + curl -fsSL https://claude.ai/install.sh | bash + + 2. **Close other processes** to free memory before installing. + 3. **Use a larger instance** if possible. Claude Code requires at least 4 GB of RAM. + +### + +​ + +Install hangs in Docker + +When installing Claude Code in a Docker container, installing as root into `/` can cause hangs. **Solutions:** + + 1. **Set a working directory** before running the installer. When run from `/`, the installer scans the entire filesystem, which causes excessive memory usage. Setting `WORKDIR` limits the scan to a small directory: + +Report incorrect code + +Copy + +Ask AI + + WORKDIR /tmp + RUN curl -fsSL https://claude.ai/install.sh | bash + + 2. **Increase Docker memory limits** if using Docker Desktop: + +Report incorrect code + +Copy + +Ask AI + + docker build --memory=4g . + +### + +​ + +Windows: Claude Desktop overrides `claude` CLI command + +If you installed an older version of Claude Desktop, it may register a `Claude.exe` in the `WindowsApps` directory that takes PATH priority over Claude Code CLI. Running `claude` opens the Desktop app instead of the CLI. Update Claude Desktop to the latest version to fix this issue. + +### + +​ + +Windows: “Claude Code on Windows requires git-bash” + +Claude Code on native Windows needs [Git for Windows](<https://git-scm.com/downloads/win>), which includes Git Bash. **If Git is not installed** , download and install it from [git-scm.com/downloads/win](<https://git-scm.com/downloads/win>). During setup, select “Add to PATH.” Restart your terminal after installing. **If Git is already installed** but Claude Code still can’t find it, set the path in your [settings.json file](</docs/en/settings>): + +Report incorrect code + +Copy + +Ask AI + + { + "env": { + "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe" + } + } + +If your Git is installed somewhere else, find the path by running `where.exe git` in PowerShell and use the `bin\bash.exe` path from that directory. + +### + +​ + +Linux: wrong binary variant installed (musl/glibc mismatch) + +If you see errors about missing shared libraries like `libstdc++.so.6` or `libgcc_s.so.1` after installation, the installer may have downloaded the wrong binary variant for your system. + +Report incorrect code + +Copy + +Ask AI + + Error loading shared library libstdc++.so.6: No such file or directory + +This can happen on glibc-based systems that have musl cross-compilation packages installed, causing the installer to misdetect the system as musl. **Solutions:** + + 1. **Check which libc your system uses** : + +Report incorrect code + +Copy + +Ask AI + + ldd /bin/ls | head -1 + +If it shows `linux-vdso.so` or references to `/lib/x86_64-linux-gnu/`, you’re on glibc. If it shows `musl`, you’re on musl. + 2. **If you’re on glibc but got the musl binary** , remove the installation and reinstall. You can also manually download the correct binary from the GCS bucket at `https://storage.googleapis.com/claude-code-dist-86c565f3-f756-42ad-8dfa-d59b1c096819/claude-code-releases/{VERSION}/manifest.json`. File a [GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output of `ldd /bin/ls` and `ls /lib/libc.musl*`. + 3. **If you’re actually on musl** (Alpine Linux), install the required packages: + +Report incorrect code + +Copy + +Ask AI + + apk add libgcc libstdc++ ripgrep + +### + +​ + +`Illegal instruction` on Linux + +If the installer prints `Illegal instruction` instead of the OOM `Killed` message, the downloaded binary doesn’t match your CPU architecture. This commonly happens on ARM servers that receive an x86 binary, or on older CPUs that lack required instruction sets. + +Report incorrect code + +Copy + +Ask AI + + bash: line 142: 2238232 Illegal instruction "$binary_path" install ${TARGET:+"$TARGET"} + +**Solutions:** + + 1. **Verify your architecture** : + +Report incorrect code + +Copy + +Ask AI + + uname -m + +`x86_64` means 64-bit Intel/AMD, `aarch64` means ARM64. If the binary doesn’t match, [file a GitHub issue](<https://github.com/anthropics/claude-code/issues>) with the output. + 2. **Try an alternative install method** while the architecture issue is resolved: + +Report incorrect code + +Copy + +Ask AI + + brew install --cask claude-code + +### + +​ + +`dyld: cannot load` on macOS + +If you see `dyld: cannot load` or `Abort trap: 6` during installation, the binary is incompatible with your macOS version or hardware. + +Report incorrect code + +Copy + +Ask AI + + dyld: cannot load 'claude-2.1.42-darwin-x64' (load command 0x80000034 is unknown) + Abort trap: 6 + +**Solutions:** + + 1. **Check your macOS version** : Claude Code requires macOS 13.0 or later. Open the Apple menu and select About This Mac to check your version. + 2. **Update macOS** if you’re on an older version. The binary uses load commands that older macOS versions don’t support. + 3. **Try Homebrew** as an alternative install method: + +Report incorrect code + +Copy + +Ask AI + + brew install --cask claude-code + +### + +​ + +Windows installation issues: errors in WSL + +You might encounter the following issues in WSL: **OS/platform detection issues** : if you receive an error during installation, WSL may be using Windows `npm`. Try: + + * Run `npm config set os linux` before installation + * Install with `npm install -g @anthropic-ai/claude-code --force --no-os-check`. Do not use `sudo`. + +**Node not found errors** : if you see `exec: node: not found` when running `claude`, your WSL environment may be using a Windows installation of Node.js. You can confirm this with `which npm` and `which node`, which should point to Linux paths starting with `/usr/` rather than `/mnt/c/`. To fix this, try installing Node via your Linux distribution’s package manager or via [`nvm`](<https://github.com/nvm-sh/nvm>). **nvm version conflicts** : if you have nvm installed in both WSL and Windows, you may experience version conflicts when switching Node versions in WSL. This happens because WSL imports the Windows PATH by default, causing Windows nvm/npm to take priority over the WSL installation. You can identify this issue by: + + * Running `which npm` and `which node` \- if they point to Windows paths (starting with `/mnt/c/`), Windows versions are being used + * Experiencing broken functionality after switching Node versions with nvm in WSL + +To resolve this issue, fix your Linux PATH to ensure the Linux node/npm versions take priority: **Primary solution: Ensure nvm is properly loaded in your shell** The most common cause is that nvm isn’t loaded in non-interactive shells. Add the following to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.): + +Report incorrect code + +Copy + +Ask AI + + # Load nvm if it exists + export NVM_DIR="$HOME/.nvm" + [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" + [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" + +Or run directly in your current session: + +Report incorrect code + +Copy + +Ask AI + + source ~/.nvm/nvm.sh + +**Alternative: Adjust PATH order** If nvm is properly loaded but Windows paths still take priority, you can explicitly prepend your Linux paths to PATH in your shell configuration: + +Report incorrect code + +Copy + +Ask AI + + export PATH="$HOME/.nvm/versions/node/$(node -v)/bin:$PATH" + +Avoid disabling Windows PATH importing via `appendWindowsPath = false` as this breaks the ability to call Windows executables from WSL. Similarly, avoid uninstalling Node.js from Windows if you use it for Windows development. + +### + +​ + +WSL2 sandbox setup + +[Sandboxing](</docs/en/sandboxing>) is supported on WSL2 but requires installing additional packages. If you see an error like “Sandbox requires socat and bubblewrap” when running `/sandbox`, install the dependencies: + + * Ubuntu/Debian + + * Fedora + +Report incorrect code + +Copy + +Ask AI + + sudo apt-get install bubblewrap socat + +Report incorrect code + +Copy + +Ask AI + + sudo dnf install bubblewrap socat + +WSL1 does not support sandboxing. If you see “Sandboxing requires WSL2”, you need to upgrade to WSL2 or run Claude Code without sandboxing. + +### + +​ + +Permission errors during installation + +If the native installer fails with permission errors, the target directory may not be writable. See Check directory permissions. If you previously installed with npm and are hitting npm-specific permission errors, switch to the native installer: + +Report incorrect code + +Copy + +Ask AI + + curl -fsSL https://claude.ai/install.sh | bash + +## + +​ + +Permissions and authentication + +These sections address login failures, token issues, and permission prompt behavior. + +### + +​ + +Repeated permission prompts + +If you find yourself repeatedly approving the same commands, you can allow specific tools to run without approval using the `/permissions` command. See [Permissions docs](</docs/en/permissions#manage-permissions>). + +### + +​ + +Authentication issues + +If you’re experiencing authentication problems: + + 1. Run `/logout` to sign out completely + 2. Close Claude Code + 3. Restart with `claude` and complete the authentication process again + +If the browser doesn’t open automatically during login, press `c` to copy the OAuth URL to your clipboard, then paste it into your browser manually. + +### + +​ + +OAuth error: Invalid code + +If you see `OAuth error: Invalid code. Please make sure the full code was copied`, the login code expired or was truncated during copy-paste. **Solutions:** + + * Press Enter to retry and complete the login quickly after the browser opens + * Type `c` to copy the full URL if the browser doesn’t open automatically + * If using a remote/SSH session, the browser may open on the wrong machine. Copy the URL displayed in the terminal and open it in your local browser instead. + +### + +​ + +403 Forbidden after login + +If you see `API Error: 403 {"error":{"type":"forbidden","message":"Request not allowed"}}` after logging in: + + * **Claude Pro/Max users** : verify your subscription is active at [claude.ai/settings](<https://claude.ai/settings>) + * **Console users** : confirm your account has the “Claude Code” or “Developer” role assigned by your admin + * **Behind a proxy** : corporate proxies can interfere with API requests. See [network configuration](</docs/en/network-config>) for proxy setup. + +### + +​ + +”This organization has been disabled” with an active subscription + +If you see `API Error: 400 ... "This organization has been disabled"` despite having an active Claude subscription, an `ANTHROPIC_API_KEY` environment variable is overriding your subscription. This commonly happens when an old API key from a previous employer or project is still set in your shell profile. When `ANTHROPIC_API_KEY` is present and you have approved it, Claude Code uses that key instead of your subscription’s OAuth credentials. In non-interactive mode (`-p`), the key is always used when present. See [authentication precedence](</docs/en/authentication#authentication-precedence>) for the full resolution order. To use your subscription instead, unset the environment variable and remove it from your shell profile: + +Report incorrect code + +Copy + +Ask AI + + unset ANTHROPIC_API_KEY + claude + +Check `~/.zshrc`, `~/.bashrc`, or `~/.profile` for `export ANTHROPIC_API_KEY=...` lines and remove them to make the change permanent. Run `/status` inside Claude Code to confirm which authentication method is active. + +### + +​ + +OAuth login fails in WSL2 + +Browser-based login in WSL2 may fail if WSL can’t open your Windows browser. Set the `BROWSER` environment variable: + +Report incorrect code + +Copy + +Ask AI + + export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe" + claude + +Or copy the URL manually: when the login prompt appears, press `c` to copy the OAuth URL, then paste it into your Windows browser. + +### + +​ + +”Not logged in” or token expired + +If Claude Code prompts you to log in again after a session, your OAuth token may have expired. Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps. + +## + +​ + +Configuration file locations + +Claude Code stores configuration in several locations: + +File| Purpose +---|--- +`~/.claude/settings.json`| User settings (permissions, hooks, model overrides) +`.claude/settings.json`| Project settings (checked into source control) +`.claude/settings.local.json`| Local project settings (not committed) +`~/.claude.json`| Global state (theme, OAuth, MCP servers) +`.mcp.json`| Project MCP servers (checked into source control) +`managed-mcp.json`| [Managed MCP servers](</docs/en/mcp#managed-mcp-configuration>) +Managed settings| [Managed settings](</docs/en/settings#settings-files>) (server-managed, MDM/OS-level policies, or file-based) + +On Windows, `~` refers to your user home directory, such as `C:\Users\YourName`. For details on configuring these files, see [Settings](</docs/en/settings>) and [MCP](</docs/en/mcp>). + +### + +​ + +Resetting configuration + +To reset Claude Code to default settings, you can remove the configuration files: + +Report incorrect code + +Copy + +Ask AI + + # Reset all user settings and state + rm ~/.claude.json + rm -rf ~/.claude/ + + # Reset project-specific settings + rm -rf .claude/ + rm .mcp.json + +This will remove all your settings, MCP server configurations, and session history. + +## + +​ + +Performance and stability + +These sections cover issues related to resource usage, responsiveness, and search behavior. + +### + +​ + +High CPU or memory usage + +Claude Code is designed to work with most development environments, but may consume significant resources when processing large codebases. If you’re experiencing performance issues: + + 1. Use `/compact` regularly to reduce context size + 2. Close and restart Claude Code between major tasks + 3. Consider adding large build directories to your `.gitignore` file + +### + +​ + +Command hangs or freezes + +If Claude Code seems unresponsive: + + 1. Press Ctrl+C to attempt to cancel the current operation + 2. If unresponsive, you may need to close the terminal and restart + +### + +​ + +Search and discovery issues + +If Search tool, `@file` mentions, custom agents, and custom skills aren’t working, install system `ripgrep`: + +Report incorrect code + +Copy + +Ask AI + + # macOS (Homebrew) + brew install ripgrep + + # Windows (winget) + winget install BurntSushi.ripgrep.MSVC + + # Ubuntu/Debian + sudo apt install ripgrep + + # Alpine Linux + apk add ripgrep + + # Arch Linux + pacman -S ripgrep + +Then set `USE_BUILTIN_RIPGREP=0` in your [environment](</docs/en/env-vars>). + +### + +​ + +Slow or incomplete search results on WSL + +Disk read performance penalties when [working across file systems on WSL](<https://learn.microsoft.com/en-us/windows/wsl/filesystems>) may result in fewer-than-expected matches when using Claude Code on WSL. Search still functions, but returns fewer results than on a native filesystem. + +`/doctor` will show Search as OK in this case. + +**Solutions:** + + 1. **Submit more specific searches** : reduce the number of files searched by specifying directories or file types: “Search for JWT validation logic in the auth-service package” or “Find use of md5 hash in JS files”. + 2. **Move project to Linux filesystem** : if possible, ensure your project is located on the Linux filesystem (`/home/`) rather than the Windows filesystem (`/mnt/c/`). + 3. **Use native Windows instead** : consider running Claude Code natively on Windows instead of through WSL, for better file system performance. + +## + +​ + +IDE integration issues + +If Claude Code does not connect to your IDE or behaves unexpectedly within an IDE terminal, try the solutions below. + +### + +​ + +JetBrains IDE not detected on WSL2 + +If you’re using Claude Code on WSL2 with JetBrains IDEs and getting “No available IDEs detected” errors, this is likely due to WSL2’s networking configuration or Windows Firewall blocking the connection. + +#### + +​ + +WSL2 networking modes + +WSL2 uses NAT networking by default, which can prevent IDE detection. You have two options: **Option 1: Configure Windows Firewall** (recommended) + + 1. Find your WSL2 IP address: + +Report incorrect code + +Copy + +Ask AI + + wsl hostname -I + # Example output: 172.21.123.45 + + 2. Open PowerShell as Administrator and create a firewall rule: + +Report incorrect code + +Copy + +Ask AI + + New-NetFirewallRule -DisplayName "Allow WSL2 Internal Traffic" -Direction Inbound -Protocol TCP -Action Allow -RemoteAddress 172.21.0.0/16 -LocalAddress 172.21.0.0/16 + +Adjust the IP range based on your WSL2 subnet from step 1. + 3. Restart both your IDE and Claude Code + +**Option 2: Switch to mirrored networking** Add to `.wslconfig` in your Windows user directory: + +Report incorrect code + +Copy + +Ask AI + + [wsl2] + networkingMode=mirrored + +Then restart WSL with `wsl --shutdown` from PowerShell. + +These networking issues only affect WSL2. WSL1 uses the host’s network directly and doesn’t require these configurations. + +For additional JetBrains configuration tips, see the [JetBrains IDE guide](</docs/en/jetbrains#plugin-settings>). + +### + +​ + +Report Windows IDE integration issues + +If you’re experiencing IDE integration problems on Windows, [create an issue](<https://github.com/anthropics/claude-code/issues>) with the following information: + + * Environment type: native Windows (Git Bash) or WSL1/WSL2 + * WSL networking mode, if applicable: NAT or mirrored + * IDE name and version + * Claude Code extension/plugin version + * Shell type: Bash, Zsh, PowerShell, etc. + +### + +​ + +Escape key not working in JetBrains IDE terminals + +If you’re using Claude Code in JetBrains terminals and the `Esc` key doesn’t interrupt the agent as expected, this is likely due to a keybinding clash with JetBrains’ default shortcuts. To fix this issue: + + 1. Go to Settings → Tools → Terminal + 2. Either: + * Uncheck “Move focus to the editor with Escape”, or + * Click “Configure terminal keybindings” and delete the “Switch focus to Editor” shortcut + 3. Apply the changes + +This allows the `Esc` key to properly interrupt Claude Code operations. + +## + +​ + +Markdown formatting issues + +Claude Code sometimes generates markdown files with missing language tags on code fences, which can affect syntax highlighting and readability in GitHub, editors, and documentation tools. + +### + +​ + +Missing language tags in code blocks + +If you notice code blocks like this in generated markdown: + +Report incorrect code + +Copy + +Ask AI + + ``` + function example() { + return "hello"; + } + ```text + +Instead of properly tagged blocks like: + +Report incorrect code + +Copy + +Ask AI + + ```javascript + function example() { + return "hello"; + } + ```text + +**Solutions:** + + 1. **Ask Claude to add language tags** : request “Add appropriate language tags to all code blocks in this markdown file.” + 2. **Use post-processing hooks** : set up automatic formatting hooks to detect and add missing language tags. See [Auto-format code after edits](</docs/en/hooks-guide#auto-format-code-after-edits>) for an example of a PostToolUse formatting hook. + 3. **Manual verification** : after generating markdown files, review them for proper code block formatting and request corrections if needed. + +### + +​ + +Inconsistent spacing and formatting + +If generated markdown has excessive blank lines or inconsistent spacing: **Solutions:** + + 1. **Request formatting corrections** : ask Claude to “Fix spacing and formatting issues in this markdown file.” + 2. **Use formatting tools** : set up hooks to run markdown formatters like `prettier` or custom formatting scripts on generated markdown files. + 3. **Specify formatting preferences** : include formatting requirements in your prompts or project [memory](</docs/en/memory>) files. + +### + +​ + +Reduce markdown formatting issues + +To minimize formatting issues: + + * **Be explicit in requests** : ask for “properly formatted markdown with language-tagged code blocks” + * **Use project conventions** : document your preferred markdown style in [`CLAUDE.md`](</docs/en/memory>) + * **Set up validation hooks** : use post-processing hooks to automatically verify and fix common formatting issues + +## + +​ + +Get more help + +If you’re experiencing issues not covered here: + + 1. Use the `/feedback` command within Claude Code to report problems directly to Anthropic + 2. Check the [GitHub repository](<https://github.com/anthropics/claude-code>) for known issues + 3. Run `/doctor` to diagnose issues. It checks: + * Installation type, version, and search functionality + * Auto-update status and available versions + * Invalid settings files (malformed JSON, incorrect types) + * MCP server configuration errors + * Keybinding configuration problems + * Context usage warnings (large CLAUDE.md files, high MCP token usage, unreachable permission rules) + * Plugin and agent loading errors + 4. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation