claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue)

Open vanman2024 opened this issue 9 months ago • 18 comments

This is amazing except for a few issues, I hope there is some session memory coming.

Environment

  • Platform (select all that apply):

    • [x] Other: WSL (Windows Subsystem for Linux)
    • [x] Claude CLI
    • [x] VS Code Terminal
  • Claude CLI version:

  • Host OS: Windows 11

  • WSL Distro: Ubuntu 22.04

  • Terminal: VS Code integrated terminal (running in WSL)

Note: I’m relatively new to working in WSL, and Claude CLI was functioning without issue when I first started using it. The hanging behavior began recently. I haven’t significantly changed my setup, so I’m unsure if this is a regression, a WSL-related compatibility issue, or something environmental.


Bug Description

Claude CLI intermittently hangs during usage in WSL. It starts fine and responds to input, but at a random point in the session, it will stop responding entirely. The process remains running, but no output is returned, and no error message is shown. This issue is disruptive and makes it difficult to maintain consistent workflows.


Steps to Reproduce

  1. Start a Claude CLI session inside WSL (Ubuntu 22.04) via the VS Code terminal.
  2. Begin a normal interaction — requesting code, asking questions, etc.
  3. After a few prompts, Claude suddenly stops responding.
  4. Run pkill on the Claude CLI process — this temporarily fixes the issue.
  5. Start a new session — the issue will usually return after some time.
  6. Occasionally, multiple Claude processes are found running simultaneously in the background.

Expected Behavior

Claude CLI should maintain consistent responsiveness throughout the session. If the session ends, times out, or encounters an error, it should return a message or log rather than silently hanging.


Actual Behavior

  • Claude responds normally for the first few prompts.
  • Then it suddenly stops responding, without logging any error or ending the session.
  • Running pkill on Claude CLI temporarily resolves the issue.
  • Multiple Claude CLI sessions are sometimes left running in the background.
  • The issue occurs intermittently and unpredictably, even after restarting WSL, rebooting, or reinstalling the CLI.

Additional Context

  • I’ve tried rebooting WSL, restarting VS Code, reinstalling the Claude CLI, switching networks, and limiting session complexity — none have resolved the issue.
  • I didn’t have this problem early on; it appeared only after some time using WSL.
  • A clearer error message, timeout warning, or a self-healing session process would be extremely helpful.
  • I’m happy to provide logs, CLI output, or run test scenarios to help diagnose.

vanman2024 avatar Mar 26 '25 08:03 vanman2024

@vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

reverie avatar Mar 26 '25 16:03 reverie

Hello Andrew,

I will take keep an eye on it. It was very frustrating to say the least. I love this tool so much best on the market by far I think and if this is only the beginning of it damn can't wait to see what comes in the future.

Is there a roadmap I could look at? One of the biggest challenges I am facing right now when the session ends is keeping the context and persistence or what last happened.

Any suggestions on how I could extend the functionality?

Thanks


From: Andrew Badr @.> Sent: Wednesday, March 26, 2025 9:49 AM To: anthropics/claude-code @.> Cc: vanman2024 @.>; Mention @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

[reverie]reverie left a comment (anthropics/claude-code#619)https://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

vanman2024 avatar Mar 26 '25 16:03 vanman2024

Hi Andrew, unfortunately, it continues to cut out during the session. Essentially, Claude just freezes and doesn't resume. I attempted everything to extend the sessions with WSL, but it actually worsens the situation when I do that.

Additionally, I don't have access to the Claude memory files when using the slash command either.


From: Andrew Badr @.> Sent: Wednesday, March 26, 2025 9:49 AM To: anthropics/claude-code @.> Cc: vanman2024 @.>; Mention @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

[reverie]reverie left a comment (anthropics/claude-code#619)https://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

vanman2024 avatar Mar 26 '25 23:03 vanman2024

I am not sure what to do . I want to continue using the tool, but I can't in this state as I keep losing context after every restart.


From: Ryan Angel @.> Sent: Wednesday, March 26, 2025 4:40 PM To: anthropics/claude-code @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

Hi Andrew, unfortunately, it continues to cut out during the session. Essentially, Claude just freezes and doesn't resume. I attempted everything to extend the sessions with WSL, but it actually worsens the situation when I do that.

Additionally, I don't have access to the Claude memory files when using the slash command either.


From: Andrew Badr @.> Sent: Wednesday, March 26, 2025 9:49 AM To: anthropics/claude-code @.> Cc: vanman2024 @.>; Mention @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

[reverie]reverie left a comment (anthropics/claude-code#619)https://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

vanman2024 avatar Mar 26 '25 23:03 vanman2024

Seems to have improved still hangs a bit but does not freeze completely.

When will a full windows version be out?


From: Ryan Angel @.> Sent: Wednesday, March 26, 2025 4:43:18 PM To: anthropics/claude-code @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

I am not sure what to do . I want to continue using the tool, but I can't in this state as I keep losing context after every restart.


From: Ryan Angel @.> Sent: Wednesday, March 26, 2025 4:40 PM To: anthropics/claude-code @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

Hi Andrew, unfortunately, it continues to cut out during the session. Essentially, Claude just freezes and doesn't resume. I attempted everything to extend the sessions with WSL, but it actually worsens the situation when I do that.

Additionally, I don't have access to the Claude memory files when using the slash command either.


From: Andrew Badr @.> Sent: Wednesday, March 26, 2025 9:49 AM To: anthropics/claude-code @.> Cc: vanman2024 @.>; Mention @.> Subject: Re: [anthropics/claude-code] Claude CLI Hangs or Becomes Unresponsive in WSL (Intermittent Issue) (Issue #619)

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

[reverie]reverie left a comment (anthropics/claude-code#619)https://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139

@vanman2024https://github.com/vanman2024 We released a new version yesterday that might have fixed this. Could you please let me know if you're still seeing it after an update?

— Reply to this email directly, view it on GitHubhttps://github.com/anthropics/claude-code/issues/619#issuecomment-2755081139, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLWU4R6EBDJD75VNSRL636L2WLLBDAVCNFSM6AAAAABZZS2X3GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONJVGA4DCMJTHE. You are receiving this because you were mentioned.Message ID: @.***>

vanman2024 avatar Mar 27 '25 06:03 vanman2024

I also use WSL with Claude Code. After longer interactions, it becomes unresponsive. I started Googling for the issue, and here I am.

visata avatar May 28 '25 05:05 visata

Just as an FYI, after running wsl --terminate Ubuntu about 50 times, I shutdown Docker Desktop (which was also using my Ubuntu instance). I haven't had a hang since...

UPDATE: Stopping and restarting Docker Desktop allows Claude to get "unhung" for a while

UPDATE 2: I believe that this might be tied to Docker entering "Resource Saver" mode. I've disabled it, and am hoping that ultimately solves the problem...

sdukehart-omnesoft avatar May 28 '25 18:05 sdukehart-omnesoft

I was testing this today, and it happen on 3 different machines. Two windows 11 and One windows 10. @sdukehart-omnesoft thanks for this as I just went in and hit the play bottom in the bottom left of docker desktop, as it was in saver mode. As soon as I did this, the wsl interface immediately responded.

So it seems that needs to be disabled in docker desktop - in case someone see this from searching for this issue.

brianlowery avatar Jun 09 '25 20:06 brianlowery

Hey, yes I can confirm this. Disable the Save resources switch in docker desktop and a restart completly fixes the extrem annoying hangs of the claude code cli under WSL 2.

christopherpross avatar Jun 20 '25 04:06 christopherpross

Same Issue in Windows App. Tool becomes unresponsive & shows Loading icon always Also tried clearing Cache and Restart, But No Result.

ParthPithadiaTR avatar Jul 17 '25 09:07 ParthPithadiaTR

I've run across this problem as well. Windows 10 with WSL2. I don't have Docker Desktop installed so believe there may be something else going on.

zyzil avatar Aug 21 '25 16:08 zyzil

I hit this every day while typing...it just hangs for 20-30 seconds @reverie

shanselman avatar Aug 26 '25 17:08 shanselman

I am using it in my windows machine and when I run the claude code in the vs code terminal, the input area hangs for like 2-3 mins and then it becomes useable. Its so frustrating each time I run claude code it just hangs like crazy.

dashingvinit avatar Sep 14 '25 17:09 dashingvinit

This issue has been inactive for 30 days. If the issue is still occurring, please comment to let us know. Otherwise, this issue will be automatically closed in 30 days for housekeeping purposes.

github-actions[bot] avatar Dec 05 '25 10:12 github-actions[bot]

Workaround that works for me:

The only reliable solution I've found is to disable Windows PATH injection in WSL2 by setting appendWindowsPath = false in .wslconfig:

# %USERPROFILE%\.wslconfig
[interop]
appendWindowsPath = false

Then restart WSL:

wsl --shutdown

I know the official troubleshooting docs recommend against this because it "breaks the ability to easily call Windows executables from WSL", but in my experience this is the only way to get Claude Code working consistently without hangs.

The trade-off is you can no longer call Windows executables directly from WSL (like explorer.exe, etc.), but Claude Code becomes stable.

garacio avatar Dec 06 '25 08:12 garacio

Workaround that works for me:

The only reliable solution I've found is to disable Windows PATH injection in WSL2 by setting appendWindowsPath = false in .wslconfig:

%USERPROFILE%.wslconfig

[interop] appendWindowsPath = false Then restart WSL:

wsl --shutdown I know the official troubleshooting docs recommend against this because it "breaks the ability to easily call Windows executables from WSL", but in my experience this is the only way to get Claude Code working consistently without hangs.

The trade-off is you can no longer call Windows executables directly from WSL (like explorer.exe, etc.), but Claude Code becomes stable.

Thanks for this adding the command didn't work for me due to the WSL / VScode integration. So just updated my Ubuntu path to not include the windows paths which seemed to have worked so far.

dwbcodes avatar Dec 11 '25 19:12 dwbcodes

TLDR

Fix : Add this to .bashrc

# Claude Code WSL2 fix
export PATH=$(echo "$PATH" | tr ':' '\n' | grep -v 'WindowsPowerShell' | tr '\n' ':' | sed 's/:$//')

With powershell in PATH

https://github.com/user-attachments/assets/7382c7ba-8f24-45e1-b3e2-38dc60ab1ea0

Without powershell in PATH

https://github.com/user-attachments/assets/d503bcca-fcac-467b-baac-1485f693ea94

Rambling

Okay so I went down the rabbit hole because this bug has been driving me nuts for months.

this from @garacio did not work for me


# %USERPROFILE%\.wslconfig
[interop]
appendWindowsPath = false

but this workaround by @dwbcodes

So just updated my Ubuntu path to not include the windows paths which seemed to have worked so far.

put me on the right track.

First I did like him and filtered all windows /mnt/c paths post shell using

export PATH=$(echo "$PATH" | tr ':' '\n' | grep -v '/mnt/c/' | tr '\n' ':' | sed 's/:$//')

and it fixed it, but this expectedly broke invoking windows binaries natively, so I went on a wild goose chase of writing custom interlop like

# local var was required in my case or path args would not pass properly otherwise
explorer() {
    local target=$(wslpath -aw "${1:-.}")
    (cd /mnt/c && $CMD /c start "" "$target") 2>/dev/null
}
alias x='explorer'

cursor() {
    local target=$(wslpath -aw "${1:-.}")
    (cd /mnt/c && $CMD /c "$WINLOCALAPPDATA\Programs\cursor\resources\app\bin\cursor.cmd" "$target") 2>/dev/null &
}

code() {
    local target=$(wslpath -aw "${1:-.}")
    (cd /mnt/c && $CMD /c "$WINLOCALAPPDATA\Programs\Microsoft VS Code Insiders\bin\code-insiders.cmd" "$target") 2>/dev/null &
}

agy() {
    local target=$(wslpath -aw "${1:-.}")
    (cd /mnt/c && $CMD /c "$WINLOCALAPPDATA\Programs\Antigravity\bin\antigravity.cmd" "$target") 2>/dev/null &
}

which works, but then I thought why not use a good old bisect to find the culprit, and isolated it to this path

/mnt/c/Windows/System32/WindowsPowerShell/v1.0

excluding this single path from my arch (btw) $PATH makes claude code responsive.

zdaar avatar Dec 12 '25 16:12 zdaar

To be honest, it is not a fix, it is a dirty hack, but, this is what we have! Thank you, @zdaar, for more clear workaround

garacio avatar Dec 23 '25 10:12 garacio