4 4
5# Troubleshooting5# Troubleshooting
6 6
7> Discover solutions to common issues with Claude Code installation and usage.7> Fix high CPU or memory usage, hangs, auto-compact thrashing, and search problems in Claude Code, and find the right page for other issues.
8 8
9## Troubleshoot installation issues9This 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:
10 10
11<Tip>11| Symptom | Go to |
12 If you'd rather skip the terminal entirely, the [Claude Code Desktop app](/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.12| :------------------------------------------------------------------------------------------------------ | :--------------------------------------------------------------------------------------- |
13</Tip>13| `command not found`, install fails, PATH issues, `EACCES`, TLS errors | [Troubleshoot installation and login](/en/troubleshoot-install) |
14| Login loops, OAuth errors, `403 Forbidden`, "organization disabled", Bedrock/Vertex/Foundry credentials | [Troubleshoot installation and login](/en/troubleshoot-install#login-and-authentication) |
15| Settings not applying, hooks not firing, MCP servers not loading | [Debug your configuration](/en/debug-your-config) |
16| `API Error: 5xx`, `529 Overloaded`, `429`, request validation errors | [Error reference](/en/errors) |
17| `model not found` or `you may not have access to it` | [Error reference](/en/errors#theres-an-issue-with-the-selected-model) |
18| VS Code extension not connecting or detecting Claude | [VS Code integration](/en/vs-code#fix-common-issues) |
19| JetBrains plugin or IDE not detected | [JetBrains integration](/en/jetbrains#troubleshooting) |
20| High CPU or memory, slow responses, hangs, search not finding files | [Performance and stability](#performance-and-stability) below |
14 21
15Find the error message or symptom you're seeing:22If 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.
16
17| What you see | Solution |
18| :-------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------- |
19| `command not found: claude` or `'claude' is not recognized` | [Fix your PATH](#command-not-found-claude-after-installation) |
20| `syntax error near unexpected token '<'` | [Install script returns HTML](#install-script-returns-html-instead-of-a-shell-script) |
21| `curl: (56) Failure writing output to destination` | [Download script first, then run it](#curl-56-failure-writing-output-to-destination) |
22| `Killed` during install on Linux | [Add swap space for low-memory servers](#install-killed-on-low-memory-linux-servers) |
23| `TLS connect error` or `SSL/TLS secure channel` | [Update CA certificates](#tls-or-ssl-connection-errors) |
24| `Failed to fetch version` or can't reach download server | [Check network and proxy settings](#check-network-connectivity) |
25| `irm is not recognized` or `&& is not valid` | [Use the right command for your shell](#windows-wrong-install-command) |
26| `'bash' is not recognized as the name of a cmdlet` | [Use the Windows installer command](#windows-wrong-install-command) |
27| `Claude Code on Windows requires git-bash` | [Install or configure Git Bash](#windows-claude-code-on-windows-requires-git-bash) |
28| `Claude Code does not support 32-bit Windows` | [Open Windows PowerShell, not the x86 entry](#windows-claude-code-does-not-support-32-bit-windows) |
29| `Error loading shared library` | [Wrong binary variant for your system](#linux-wrong-binary-variant-installed-musl/glibc-mismatch) |
30| `Illegal instruction` on Linux | [Architecture mismatch](#illegal-instruction-on-linux) |
31| `dyld: cannot load`, `dyld: Symbol not found`, or `Abort trap` on macOS | [Binary incompatibility](#dyld-cannot-load-on-macos) |
32| `Invoke-Expression: Missing argument in parameter list` | [Install script returns HTML](#install-script-returns-html-instead-of-a-shell-script) |
33| `App unavailable in region` | Claude Code is not available in your country. See [supported countries](https://www.anthropic.com/supported-countries). |
34| `unable to get local issuer certificate` | [Configure corporate CA certificates](#tls-or-ssl-connection-errors) |
35| `OAuth error` or `403 Forbidden` | [Fix authentication](#authentication-issues) |
36| `API Error: 500`, `529 Overloaded`, `429`, or other 4xx and 5xx errors not listed above | See the [Error reference](/en/errors) |
37
38If your issue isn't listed, work through these diagnostic steps.
39
40## Debug installation problems
41
42### Check network connectivity
43
44The installer downloads from `downloads.claude.ai`. Verify you can reach it:
45
46```bash theme={null}
47curl -sI https://downloads.claude.ai
48```
49
50If this fails, your network may be blocking the connection. Common causes:
51
52* Corporate firewalls or proxies blocking `downloads.claude.ai`
53* Regional network restrictions: try a VPN or alternative network
54* TLS/SSL issues: update your system's CA certificates, or check if `HTTPS_PROXY` is configured
55
56If 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.
57
58This example sets both proxy variables, then runs the installer through your proxy:
59
60```bash theme={null}
61export HTTP_PROXY=http://proxy.example.com:8080
62export HTTPS_PROXY=http://proxy.example.com:8080
63curl -fsSL https://claude.ai/install.sh | bash
64```
65
66### Verify your PATH
67
68If 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.
69
70Check if the install directory is in your PATH by listing your PATH entries and filtering for `local/bin`:
71
72<Tabs>
73 <Tab title="macOS/Linux">
74 ```bash theme={null}
75 echo $PATH | tr ':' '\n' | grep local/bin
76 ```
77
78 If there's no output, the directory is missing. Add it to your shell configuration:
79
80 ```bash theme={null}
81 # Zsh (macOS default)
82 echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
83 source ~/.zshrc
84
85 # Bash (Linux default)
86 echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
87 source ~/.bashrc
88 ```
89
90 Alternatively, close and reopen your terminal.
91
92 Verify the fix worked:
93
94 ```bash theme={null}
95 claude --version
96 ```
97 </Tab>
98
99 <Tab title="Windows PowerShell">
100 ```powershell theme={null}
101 $env:PATH -split ';' | Select-String 'local\\bin'
102 ```
103
104 If there's no output, add the install directory to your User PATH:
105
106 ```powershell theme={null}
107 $currentPath = [Environment]::GetEnvironmentVariable('PATH', 'User')
108 [Environment]::SetEnvironmentVariable('PATH', "$currentPath;$env:USERPROFILE\.local\bin", 'User')
109 ```
110
111 Restart your terminal for the change to take effect.
112
113 Verify the fix worked:
114
115 ```powershell theme={null}
116 claude --version
117 ```
118 </Tab>
119
120 <Tab title="Windows CMD">
121 ```batch theme={null}
122 echo %PATH% | findstr /i "local\bin"
123 ```
124
125 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.
126
127 Verify the fix worked:
128
129 ```batch theme={null}
130 claude --version
131 ```
132 </Tab>
133</Tabs>
134
135### Check for conflicting installations
136
137Multiple Claude Code installations can cause version mismatches or unexpected behavior. Check what's installed:
138
139<Tabs>
140 <Tab title="macOS/Linux">
141 List all `claude` binaries found in your PATH:
142
143 ```bash theme={null}
144 which -a claude
145 ```
146
147 Check whether the native installer and npm versions are present:
148
149 ```bash theme={null}
150 ls -la ~/.local/bin/claude
151 ```
152
153 ```bash theme={null}
154 ls -la ~/.claude/local/
155 ```
156
157 ```bash theme={null}
158 npm -g ls @anthropic-ai/claude-code 2>/dev/null
159 ```
160 </Tab>
161
162 <Tab title="Windows PowerShell">
163 ```powershell theme={null}
164 where.exe claude
165 Test-Path "$env:LOCALAPPDATA\Claude Code\claude.exe"
166 ```
167 </Tab>
168</Tabs>
169
170If you find multiple installations, keep only one. The native install at `~/.local/bin/claude` is recommended. Remove any extra installations:
171
172Uninstall an npm global install:
173
174```bash theme={null}
175npm uninstall -g @anthropic-ai/claude-code
176```
177
178Remove a Homebrew install on macOS (use `claude-code@latest` if you installed that cask):
179
180```bash theme={null}
181brew uninstall --cask claude-code
182```
183
184### Check directory permissions
185
186The installer needs write access to `~/.local/bin/` and `~/.claude/`. If installation fails with permission errors, check whether these directories are writable:
187
188```bash theme={null}
189test -w ~/.local/bin && echo "writable" || echo "not writable"
190test -w ~/.claude && echo "writable" || echo "not writable"
191```
192
193If either directory isn't writable, create the install directory and set your user as the owner:
194
195```bash theme={null}
196sudo mkdir -p ~/.local/bin
197sudo chown -R $(whoami) ~/.local
198```
199
200### Verify the binary works
201
202If `claude` is installed but crashes or hangs on startup, run these checks to narrow down the cause.
203
204Confirm the binary exists and is executable:
205
206```bash theme={null}
207ls -la $(which claude)
208```
209
210On 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](/en/setup#alpine-linux-and-musl-based-distributions).
211
212```bash theme={null}
213ldd $(which claude) | grep "not found"
214```
215
216Run a quick sanity check that the binary can execute:
217
218```bash theme={null}
219claude --version
220```
221
222## Common installation issues
223
224These are the most frequently encountered installation problems and their solutions.
225
226### Install script returns HTML instead of a shell script
227
228When running the install command, you may see one of these errors:
229
230```text theme={null}
231bash: line 1: syntax error near unexpected token `<'
232bash: line 1: `<!DOCTYPE html>'
233```
234
235On PowerShell, the same problem appears as:
236
237```text theme={null}
238Invoke-Expression: Missing argument in parameter list.
239```
240
241This 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).
242
243Otherwise, this can happen due to network issues, regional routing, or a temporary service disruption.
244
245**Solutions:**
246
2471. **Use an alternative install method**:
248
249 On macOS or Linux, install via Homebrew:
250
251 ```bash theme={null}
252 brew install --cask claude-code
253 ```
254
255 On Windows, install via WinGet:
256
257 ```powershell theme={null}
258 winget install Anthropic.ClaudeCode
259 ```
260
2612. **Retry after a few minutes**: the issue is often temporary. Wait and try the original command again.
262
263### `command not found: claude` after installation
264
265The install finished but `claude` doesn't work. The exact error varies by platform:
266
267| Platform | Error message |
268| :---------- | :--------------------------------------------------------------------- |
269| macOS | `zsh: command not found: claude` |
270| Linux | `bash: claude: command not found` |
271| Windows CMD | `'claude' is not recognized as an internal or external command` |
272| PowerShell | `claude : The term 'claude' is not recognized as the name of a cmdlet` |
273
274This means the install directory isn't in your shell's search path. See [Verify your PATH](#verify-your-path) for the fix on each platform.
275
276### `curl: (56) Failure writing output to destination`
277
278The `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.
279
280**Solutions:**
281
2821. **Check network stability**: Claude Code binaries are hosted at `downloads.claude.ai`. Test that you can reach it:
283 ```bash theme={null}
284 curl -fsSL https://downloads.claude.ai -o /dev/null
285 ```
286 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.
287
2882. **Try an alternative install method**:
289
290 On macOS or Linux:
291
292 ```bash theme={null}
293 brew install --cask claude-code
294 ```
295
296 On Windows:
297
298 ```powershell theme={null}
299 winget install Anthropic.ClaudeCode
300 ```
301
302### TLS or SSL connection errors
303
304Errors 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.
305
306**Solutions:**
307
3081. **Update your system CA certificates**:
309
310 On Ubuntu/Debian:
311
312 ```bash theme={null}
313 sudo apt-get update && sudo apt-get install ca-certificates
314 ```
315
316 On macOS via Homebrew:
317
318 ```bash theme={null}
319 brew install ca-certificates
320 ```
321
3222. **On Windows, enable TLS 1.2** in PowerShell before running the installer:
323 ```powershell theme={null}
324 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
325 irm https://claude.ai/install.ps1 | iex
326 ```
327
3283. **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:
329 ```bash theme={null}
330 export NODE_EXTRA_CA_CERTS=/path/to/corporate-ca.pem
331 ```
332 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.
333
3344. **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:
335 ```bat theme={null}
336 curl --ssl-revoke-best-effort -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
337 ```
338 Alternatively, install with `winget install Anthropic.ClaudeCode`, which avoids curl entirely.
339
340### `Failed to fetch version from downloads.claude.ai`
341
342The installer couldn't reach the download server. This typically means `downloads.claude.ai` is blocked on your network.
343
344**Solutions:**
345
3461. **Test connectivity directly**:
347 ```bash theme={null}
348 curl -sI https://downloads.claude.ai
349 ```
350
3512. **If behind a proxy**, set `HTTPS_PROXY` so the installer can route through it. See [proxy configuration](/en/network-config#proxy-configuration) for details.
352 ```bash theme={null}
353 export HTTPS_PROXY=http://proxy.example.com:8080
354 curl -fsSL https://claude.ai/install.sh | bash
355 ```
356
3573. **If on a restricted network**, try a different network or VPN, or use an alternative install method:
358
359 On macOS or Linux:
360
361 ```bash theme={null}
362 brew install --cask claude-code
363 ```
364
365 On Windows:
366
367 ```powershell theme={null}
368 winget install Anthropic.ClaudeCode
369 ```
370
371### Windows: wrong install command
372
373If 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.
374
375* **`irm` not recognized**: you're in CMD, not PowerShell. You have two options:
376
377 Open PowerShell by searching for "PowerShell" in the Start menu, then run the original install command:
378
379 ```powershell theme={null}
380 irm https://claude.ai/install.ps1 | iex
381 ```
382
383 Or stay in CMD and use the CMD installer instead:
384
385 ```batch theme={null}
386 curl -fsSL https://claude.ai/install.cmd -o install.cmd && install.cmd && del install.cmd
387 ```
388
389* **`&&` not valid**: you're in PowerShell but ran the CMD installer command. Use the PowerShell installer:
390 ```powershell theme={null}
391 irm https://claude.ai/install.ps1 | iex
392 ```
393
394* **`bash` not recognized**: you ran the macOS/Linux installer on Windows. Use the PowerShell installer instead:
395 ```powershell theme={null}
396 irm https://claude.ai/install.ps1 | iex
397 ```
398
399### Install killed on low-memory Linux servers
400
401If you see `Killed` during installation on a VPS or cloud instance:
402
403```text theme={null}
404Setting up Claude Code...
405Installing Claude Code native build latest...
406bash: line 142: 34803 Killed "$binary_path" install ${TARGET:+"$TARGET"}
407```
408
409The Linux OOM killer terminated the process because the system ran out of memory. Claude Code requires at least 4 GB of available RAM.
410
411**Solutions:**
412
4131. **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.
414
415 Create a 2 GB swap file and enable it:
416
417 ```bash theme={null}
418 sudo fallocate -l 2G /swapfile
419 sudo chmod 600 /swapfile
420 sudo mkswap /swapfile
421 sudo swapon /swapfile
422 ```
423
424 Then retry the installation:
425
426 ```bash theme={null}
427 curl -fsSL https://claude.ai/install.sh | bash
428 ```
429
4302. **Close other processes** to free memory before installing.
431
4323. **Use a larger instance** if possible. Claude Code requires at least 4 GB of RAM.
433
434### Install hangs in Docker
435
436When installing Claude Code in a Docker container, installing as root into `/` can cause hangs.
437
438**Solutions:**
439
4401. **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:
441 ```dockerfile theme={null}
442 WORKDIR /tmp
443 RUN curl -fsSL https://claude.ai/install.sh | bash
444 ```
445
4462. **Increase Docker memory limits** if using Docker Desktop:
447 ```bash theme={null}
448 docker build --memory=4g .
449 ```
450
451### Windows: Claude Desktop overrides `claude` CLI command
452
453If 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.
454
455Update Claude Desktop to the latest version to fix this issue.
456
457### Windows: Claude Code on Windows requires git-bash
458
459Claude Code on native Windows needs [Git for Windows](https://git-scm.com/downloads/win), which includes Git Bash.
460
461**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.
462
463**If Git is already installed** but Claude Code still can't find it, set the path in your [settings.json file](/en/settings):
464
465```json theme={null}
466{
467 "env": {
468 "CLAUDE_CODE_GIT_BASH_PATH": "C:\\Program Files\\Git\\bin\\bash.exe"
469 }
470}
471```
472
473If 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.
474
475### Windows: Claude Code does not support 32-bit Windows
476
477Windows 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:
478
479```powershell theme={null}
480[Environment]::Is64BitOperatingSystem
481```
482
483If this prints `True`, your operating system is fine. Close the window, open `Windows PowerShell` without the x86 suffix, and run the install command again.
484
485If this prints `False`, you are on a 32-bit edition of Windows. Claude Code requires a 64-bit operating system. See the [system requirements](/en/setup#system-requirements).
486
487### Linux: wrong binary variant installed (musl/glibc mismatch)
488
489If 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.
490
491```text theme={null}
492Error loading shared library libstdc++.so.6: No such file or directory
493```
494
495This can happen on glibc-based systems that have musl cross-compilation packages installed, causing the installer to misdetect the system as musl.
496
497**Solutions:**
498
4991. **Check which libc your system uses**:
500 ```bash theme={null}
501 ldd /bin/ls | head -1
502 ```
503 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.
504
5052. **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*`.
506
5073. **If you're actually on musl** (Alpine Linux), install the required packages:
508 ```bash theme={null}
509 apk add libgcc libstdc++ ripgrep
510 ```
511
512### `Illegal instruction` on Linux
513
514If 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.
515
516```text theme={null}
517bash: line 142: 2238232 Illegal instruction "$binary_path" install ${TARGET:+"$TARGET"}
518```
519
520**Solutions:**
521
5221. **Verify your architecture**:
523 ```bash theme={null}
524 uname -m
525 ```
526 `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.
527
5282. **Try an alternative install method** while the architecture issue is resolved:
529 ```bash theme={null}
530 brew install --cask claude-code
531 ```
532
533### `dyld: cannot load` on macOS
534
535If 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.
536
537```text theme={null}
538dyld: cannot load 'claude-2.1.42-darwin-x64' (load command 0x80000034 is unknown)
539Abort trap: 6
540```
541
542A `Symbol not found` error that references `libicucore` also indicates your macOS version is older than the binary supports:
543
544```text theme={null}
545dyld: Symbol not found: _ubrk_clone
546 Referenced from: claude-darwin-x64 (which was built for Mac OS X 13.0)
547 Expected in: /usr/lib/libicucore.A.dylib
548```
549
550**Solutions:**
551
5521. **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.
553
5542. **Update macOS** if you're on an older version. The binary uses load commands that older macOS versions don't support.
555
5563. **Try Homebrew** as an alternative install method:
557 ```bash theme={null}
558 brew install --cask claude-code
559 ```
560
561### Windows installation issues: errors in WSL
562
563You might encounter the following issues in WSL:
564
565**OS/platform detection issues**: if you receive an error during installation, WSL may be using Windows `npm`. Try:
566
567* Run `npm config set os linux` before installation
568* Install with `npm install -g @anthropic-ai/claude-code --force --no-os-check`. Do not use `sudo`.
569
570**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).
571
572**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.
573
574You can identify this issue by:
575
576* Running `which npm` and `which node` - if they point to Windows paths (starting with `/mnt/c/`), Windows versions are being used
577* Experiencing broken functionality after switching Node versions with nvm in WSL
578
579To resolve this issue, fix your Linux PATH to ensure the Linux node/npm versions take priority:
580
581**Primary solution: Ensure nvm is properly loaded in your shell**
582
583The most common cause is that nvm isn't loaded in non-interactive shells. Add the following to your shell configuration file (`~/.bashrc`, `~/.zshrc`, etc.):
584
585```bash theme={null}
586# Load nvm if it exists
587export NVM_DIR="$HOME/.nvm"
588[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
589[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
590```
591
592Or run directly in your current session:
593
594```bash theme={null}
595source ~/.nvm/nvm.sh
596```
597
598**Alternative: Adjust PATH order**
599
600If nvm is properly loaded but Windows paths still take priority, you can explicitly prepend your Linux paths to PATH in your shell configuration:
601
602```bash theme={null}
603export PATH="$HOME/.nvm/versions/node/$(node -v)/bin:$PATH"
604```
605
606<Warning>
607 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.
608</Warning>
609
610### WSL2 sandbox setup
611
612[Sandboxing](/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:
613
614<Tabs>
615 <Tab title="Ubuntu/Debian">
616 ```bash theme={null}
617 sudo apt-get install bubblewrap socat
618 ```
619 </Tab>
620
621 <Tab title="Fedora">
622 ```bash theme={null}
623 sudo dnf install bubblewrap socat
624 ```
625 </Tab>
626</Tabs>
627
628WSL1 does not support sandboxing. If you see "Sandboxing requires WSL2", you need to upgrade to WSL2 or run Claude Code without sandboxing.
629
630Sandboxed 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`](/en/settings#sandbox-settings) so it runs outside the sandbox.
631
632### Permission errors during installation
633
634If the native installer fails with permission errors, the target directory may not be writable. See [Check directory permissions](#check-directory-permissions).
635
636If you previously installed with npm and are hitting npm-specific permission errors, switch to the native installer:
637
638```bash theme={null}
639curl -fsSL https://claude.ai/install.sh | bash
640```
641
642### Native binary not found after npm install
643
644The `@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:
645
646* **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.
647* **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](/en/setup#system-requirements).
648* **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.
649
650Installing 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.
651
652## Permissions and authentication
653
654These sections address login failures, token issues, and permission prompt behavior.
655
656### Repeated permission prompts
657
658If you find yourself repeatedly approving the same commands, you can allow specific tools
659to run without approval using the `/permissions` command. See [Permissions docs](/en/permissions#manage-permissions).
660
661### Authentication issues
662
663If you're experiencing authentication problems:
664
6651. Run `/logout` to sign out completely
6662. Close Claude Code
6673. Restart with `claude` and complete the authentication process again
668
669If 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.
670
671### OAuth error: Invalid code
672
673If you see `OAuth error: Invalid code. Please make sure the full code was copied`, the login code expired or was truncated during copy-paste.
674
675**Solutions:**
676
677* Press Enter to retry and complete the login quickly after the browser opens
678* Type `c` to copy the full URL if the browser doesn't open automatically
679* 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.
680
681### 403 Forbidden after login
682
683If you see `API Error: 403 {"error":{"type":"forbidden","message":"Request not allowed"}}` after logging in:
684
685* **Claude Pro/Max users**: verify your subscription is active at [claude.ai/settings](https://claude.ai/settings)
686* **Console users**: confirm your account has the "Claude Code" or "Developer" role assigned by your admin
687* **Behind a proxy**: corporate proxies can interfere with API requests. See [network configuration](/en/network-config) for proxy setup.
688
689### Model not found or not accessible
690
691If 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.
692
693Common causes:
694
695* A typo in the model name passed to `--model`
696* A stale or deprecated model ID saved in your settings
697* An API key without access to that model on your current usage tier
698
699Check where the model is set, in [priority order](/en/model-config#setting-your-model):
700
701* The `--model` flag
702* The `ANTHROPIC_MODEL` environment variable
703* The `model` field in `.claude/settings.local.json`
704* The `model` field in your project's `.claude/settings.json`
705* The `model` field in `~/.claude/settings.json`
706
707To 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.
708
709To 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](/en/google-vertex-ai#troubleshooting).
710
711### This organization has been disabled with an active subscription
712
713If 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.
714
715When `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](/en/authentication#authentication-precedence) for the full resolution order.
716
717To use your subscription instead, unset the environment variable and remove it from your shell profile:
718
719```bash theme={null}
720unset ANTHROPIC_API_KEY
721claude
722```
723
724Check `~/.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.
725
726### OAuth login fails in WSL2
727
728Browser-based login in WSL2 may fail if WSL can't open your Windows browser. Set the `BROWSER` environment variable:
729
730```bash theme={null}
731export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
732claude
733```
734
735Or copy the URL manually: when the login prompt appears, press `c` to copy the OAuth URL, then paste it into your Windows browser.
736
737### Not logged in or token expired
738
739If Claude Code prompts you to log in again after a session, your OAuth token may have expired.
740
741Run `/login` to re-authenticate. If this happens frequently, check that your system clock is accurate, as token validation depends on correct timestamps.
742
743On 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.
744
745## Configuration file locations
746
747Claude Code stores configuration in several locations:
748
749| File | Purpose |
750| :---------------------------- | :----------------------------------------------------------------------------------------------------- |
751| `~/.claude/settings.json` | User settings (permissions, hooks, model overrides) |
752| `.claude/settings.json` | Project settings (checked into source control) |
753| `.claude/settings.local.json` | Local project settings (not committed) |
754| `~/.claude.json` | Global state (theme, OAuth, MCP servers) |
755| `.mcp.json` | Project MCP servers (checked into source control) |
756| `managed-mcp.json` | [Managed MCP servers](/en/mcp#managed-mcp-configuration) |
757| Managed settings | [Managed settings](/en/settings#settings-files) (server-managed, MDM/OS-level policies, or file-based) |
758
759On Windows, `~` refers to your user home directory, such as `C:\Users\YourName`.
760
761For details on configuring these files, see [Settings](/en/settings) and [MCP](/en/mcp).
762
763### Resetting configuration
764
765To reset Claude Code to default settings, you can remove the configuration files:
766
767```bash theme={null}
768# Reset all user settings and state
769rm ~/.claude.json
770rm -rf ~/.claude/
771
772# Reset project-specific settings
773rm -rf .claude/
774rm .mcp.json
775```
776
777<Warning>
778 This will remove all your settings, MCP server configurations, and session history.
779</Warning>
780 23
781## Performance and stability24## Performance and stability
782 25
7902. Close and restart Claude Code between major tasks332. Close and restart Claude Code between major tasks
7913. Consider adding large build directories to your `.gitignore` file343. Consider adding large build directories to your `.gitignore` file
792 35
793If 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).36If 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.
37
38The 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).
794 39
795### Auto-compaction stops with a thrashing error40### Auto-compaction stops with a thrashing error
796 41
8101. Press Ctrl+C to attempt to cancel the current operation551. Press Ctrl+C to attempt to cancel the current operation
8112. If unresponsive, you may need to close the terminal and restart562. If unresponsive, you may need to close the terminal and restart
812 57
58Restarting doesn't lose your conversation. Run `claude --resume` in the same directory to pick the session back up.
59
813### Search and discovery issues60### Search and discovery issues
814 61
815If Search tool, `@file` mentions, custom agents, and custom skills aren't working, install system `ripgrep`:62If 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:
816 63
817```bash theme={null}64<Tabs>
818# macOS (Homebrew) 65 <Tab title="macOS">
819brew install ripgrep66 ```bash theme={null}
67 brew install ripgrep
68 ```
69 </Tab>
820 70
821# Windows (winget)71 <Tab title="Ubuntu/Debian">
822winget install BurntSushi.ripgrep.MSVC72 ```bash theme={null}
73 sudo apt install ripgrep
74 ```
75 </Tab>
823 76
824# Ubuntu/Debian77 <Tab title="Alpine">
825sudo apt install ripgrep78 ```bash theme={null}
79 apk add ripgrep
80 ```
81 </Tab>
826 82
827# Alpine Linux83 <Tab title="Arch">
828apk add ripgrep84 ```bash theme={null}
85 pacman -S ripgrep
86 ```
87 </Tab>
829 88
830# Arch Linux89 <Tab title="Windows">
831pacman -S ripgrep90 ```powershell theme={null}
832```91 winget install BurntSushi.ripgrep.MSVC
92 ```
93 </Tab>
94</Tabs>
833 95
834Then set `USE_BUILTIN_RIPGREP=0` in your [environment](/en/env-vars).96Then set `USE_BUILTIN_RIPGREP=0` in your [environment](/en/env-vars).
835 97
849 111
8503. **Use native Windows instead**: consider running Claude Code natively on Windows instead of through WSL, for better file system performance.1123. **Use native Windows instead**: consider running Claude Code natively on Windows instead of through WSL, for better file system performance.
851 113
852## IDE integration issues
853
854If Claude Code does not connect to your IDE or behaves unexpectedly within an IDE terminal, try the solutions below.
855
856### JetBrains IDE not detected on WSL2
857
858If 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.
859
860#### WSL2 networking modes
861
862WSL2 uses NAT networking by default, which can prevent IDE detection. You have two options:
863
864**Option 1: Configure Windows Firewall** (recommended)
865
8661. Find your WSL2 IP address:
867 ```bash theme={null}
868 wsl hostname -I
869 # Example output: 172.21.123.45
870 ```
871
8722. Open PowerShell as Administrator and create a firewall rule:
873 ```powershell theme={null}
874 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
875 ```
876 Adjust the IP range based on your WSL2 subnet from step 1.
877
8783. Restart both your IDE and Claude Code
879
880**Option 2: Switch to mirrored networking**
881
882Add to `.wslconfig` in your Windows user directory:
883
884```ini theme={null}
885[wsl2]
886networkingMode=mirrored
887```
888
889Then restart WSL with `wsl --shutdown` from PowerShell.
890
891<Note>
892 These networking issues only affect WSL2. WSL1 uses the host's network directly and doesn't require these configurations.
893</Note>
894
895For additional JetBrains configuration tips, see the [JetBrains IDE guide](/en/jetbrains#plugin-settings).
896
897### Report Windows IDE integration issues
898
899If you're experiencing IDE integration problems on Windows, [create an issue](https://github.com/anthropics/claude-code/issues) with the following information:
900
901* Environment type: native Windows (Git Bash) or WSL1/WSL2
902* WSL networking mode, if applicable: NAT or mirrored
903* IDE name and version
904* Claude Code extension/plugin version
905* Shell type: Bash, Zsh, PowerShell, etc.
906
907### Escape key not working in JetBrains IDE terminals
908
909If 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.
910
911To fix this issue:
912
9131. Go to Settings → Tools → Terminal
9142. Either:
915 * Uncheck "Move focus to the editor with Escape", or
916 * Click "Configure terminal keybindings" and delete the "Switch focus to Editor" shortcut
9173. Apply the changes
918
919This allows the `Esc` key to properly interrupt Claude Code operations.
920
921## Markdown formatting issues
922
923Claude 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.
924
925### Missing language tags in code blocks
926
927If you notice code blocks like this in generated markdown:
928
929````markdown theme={null}
930```
931function example() {
932 return "hello";
933}
934```
935````
936
937Instead of properly tagged blocks like:
938
939````markdown theme={null}
940```javascript
941function example() {
942 return "hello";
943}
944```
945````
946
947**Solutions:**
948
9491. **Ask Claude to add language tags**: request "Add appropriate language tags to all code blocks in this markdown file."
950
9512. **Use post-processing hooks**: set up automatic formatting hooks to detect and add missing language tags. See [Auto-format code after edits](/en/hooks-guide#auto-format-code-after-edits) for an example of a PostToolUse formatting hook.
952
9533. **Manual verification**: after generating markdown files, review them for proper code block formatting and request corrections if needed.
954
955### Inconsistent spacing and formatting
956
957If generated markdown has excessive blank lines or inconsistent spacing:
958
959**Solutions:**
960
9611. **Request formatting corrections**: ask Claude to "Fix spacing and formatting issues in this markdown file."
962
9632. **Use formatting tools**: set up hooks to run markdown formatters like `prettier` or custom formatting scripts on generated markdown files.
964
9653. **Specify formatting preferences**: include formatting requirements in your prompts or project [memory](/en/memory) files.
966
967### Reduce markdown formatting issues
968
969To minimize formatting issues:
970
971* **Be explicit in requests**: ask for "properly formatted markdown with language-tagged code blocks"
972* **Use project conventions**: document your preferred markdown style in [`CLAUDE.md`](/en/memory)
973* **Set up validation hooks**: use post-processing hooks to automatically verify and fix common formatting issues
974
975## Get more help114## Get more help
976 115
977If you're experiencing issues not covered here:116If you're experiencing issues not covered here:
978 117
9791. See the [Error reference](/en/errors) for `API Error: 5xx`, `529 Overloaded`, `429`, and request validation errors that appear during a session1181. Run `/doctor` to check installation health, settings validity, MCP configuration, and context usage in one pass
9802. Use the `/feedback` command within Claude Code to report problems directly to Anthropic1192. Use the `/feedback` command within Claude Code to report problems directly to Anthropic
9813. Check the [GitHub repository](https://github.com/anthropics/claude-code) for known issues1203. Check the [GitHub repository](https://github.com/anthropics/claude-code) for known issues
9824. Run `/doctor` to diagnose issues. It checks:1214. Ask Claude directly about its capabilities and features. Claude has built-in access to its documentation.
983 * Installation type, version, and search functionality
984 * Auto-update status and available versions
985 * Invalid settings files (malformed JSON, incorrect types)
986 * MCP server configuration errors, including the same server name defined in multiple scopes with different endpoints
987 * Keybinding configuration problems
988 * Context usage warnings (large CLAUDE.md files, high MCP token usage, unreachable permission rules)
989 * Plugin and agent loading errors
9905. Ask Claude directly about its capabilities and features - Claude has built-in access to its documentation