[BUG] Claude code 2.1.83 and above broken on WSL1
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
When starting claude code via 'claude' in a Windows WSL 1 environment, version 2.1.83 fails to start with a '-bash: /home/user/.local/bin/claude: cannot execute binary file: Exec format error'. version 2.1.81 works on WSL 1. This is not using the npm install, but the curl install (curl -fsSL https://claude.ai/install.sh | bash)
What Should Happen?
claude code (cli) should start without an error
Error Messages/Logs
-bash: /home/user/.local/bin/claude: cannot execute binary file: Exec format error
Steps to Reproduce
1) create a wsl 1 environment:
(WSL version: 2.6.3.0
Kernel version: 6.6.87.2-1
WSLg version: 1.0.71
MSRDC version: 1.2.6353
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.19045.6466
Ubuntu (Default)
2) install claude:
(curl -fsSL https://claude.ai/install.sh | bash)
3) start claude
(claude)
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
2.1.81
Claude Code Version
2.1.83
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
WSL (Windows Subsystem for Linux)
Additional Information
_No response_
24 Comments
Found 1 possible duplicate issue:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
This is probably the same root issue as #38644. This is failing on an 'auto update' silently until claude is started again. Running 2.1.81, silent update, exit 2.1.81. Restart claude (now 2.1.83) and failure.
I can confirm this. I had to roll back to 2.1.81. Claude even told me to come here and file a bug report 😆
"You're back up and running! The rollback to 2.1.81 worked.
To recap: version 2.1.83 introduced a regression that breaks WSL 1, while 2.1.81 works fine. And consider filing a bug report at https://github.com/anthropics/claude-code/issues with the details — kernel version 4.4.0-19041-Microsoft (WSL 1), Ubuntu 24.04, and that 2.1.83 fails with Exec format error while 2.1.81 works fine."
Root cause analysis: comparing ELF program headers between 2.1.81 (works) and 2.1.84 (broken):
2.1.81 segment 08: GNU_STACK (standard, zero file size)
2.1.84 segment 08: LOAD with .bun section (~129 MB, alignment 0x1000)
The new .bun LOAD segment was introduced in the Bun runtime update between 2.1.81 and 2.1.83. WSL 1's ELF loader cannot handle this segment layout. This is the same class of bug as Ubuntu LP#1966849 (gzip broken on WSL 1 due to non-standard LOAD alignment).
Full readelf -l diff available in #39385.
WSL1 Workaround: Force Node.js Fallback
After digging into the minified
extension.js(VS Code extension), I found that the extension already has a Node.js fallback path built in. The functiongetClaudeBinary()works like this:resources/native-binary/clauderesources/claude-code/cli.jsrunning via Node.jsThe problem is that the binary exists on disk (so step 1 succeeds), but WSL1 can't execute it. The extension never reaches the fallback.
The Fix
Force the extension to use the Node.js fallback by:
cli.jsfrom the npm packageScript
Auto-patch on updates
Add this to your
~/.bashrcto automatically detect and patch new extension versions on every terminal open:Why this works
The extension's
getClaudeBinary()method checks forresources/native-binary/claudefirst. If absent, it looks forresources/claude-code/cli.jsand runs it via Node.js (process.execPath). This was the execution path in v2.1.81 and earlier. By removing the native binary and providingcli.js, we restore the old behavior.Suggestion for Anthropic
A proper fix would be a ~5 line change in
getClaudeBinary(): after finding the native binary path, try executing it with--version. If it fails (exit code !== 0), fall back to the Node.js path. This would make the extension self-healing on WSL1 and any other platform where the Bun binary can't run.Tested on WSL1 (kernel 4.4.0, Ubuntu) with extension v2.1.85 — both the VS Code sidebar and editor panels work correctly via the Node.js fallback.
I updated to 2.1.88 on a different machine through npm. I don't get the error, so it might have fixed it even though the release notes do not mention this bug.
This is still broken via 'curl -fsSL https://claude.ai/install.sh | bash'
Setting up Claude Code...
bash: line 151: /home/userdir/.claude/downloads/claude-2.1.87-linux-x64: cannot execute binary file: Exec format error
Although I do note this is version 2.1.87 and not 2.1.88 being pulled
I noticed that they pulled 2.1.88 as well. It was up for a few hours when it updated for me.
Whoops. Looks like this is why they pulled it: CLI
2.1.90 installed via curl still broken
curl -fsSL https://claude.ai/install.sh | bash
Setting up Claude Code...
bash: line 151: /home/userdir/.claude/downloads/claude-2.1.90-linux-x64: cannot execute binary file: Exec format error
I have the same issue
here's a workaround:
for my setup the following workaround works fine.
Add this to your
~/.bashrc:(replace the term
userwith your appropiate username.This way auto updates replacing the claude symlink will continue to work.
This started happening to me after the self-update went to 2.1.113 but fine after rolling back to 2.1.112
Has this issue not been resolved yet?
I am struggling because I am forced to use WSL1 due to my specific development environment requirements.
According to the Claude Code reference, WSL1 is still listed as a supported environment.
I have the same issue.
Worked for be as well but because I use fnm I had to modify it to the following:
Even if that alias fixes existing installations, it's not possible to actually install the application from scratch with this issue.
It is possible, you just run the installer until it crashes, and then you can run the extracted package the same way and it will work. It's annoying, but it's doable since it's a 1 time thing.
Something like
/lib64/ld-linux-x86-64.so.2 "$HOME/.claude/downloads/claude-2.x.xxx-linux-x64" installI got around it by reading install.sh and downloading the right file manually. I just mentioned it to say that the proposed work-around only works for situations when it's already installed.
This is still an issue, at least with the apt package:
Using
ld-linuxas a workaround breaks grep/find/rg — here's a fixThe
ld-linuxlaunch workaround gets Claude running, but causes a secondary bug: all grep, find, and rg tool calls fail with:Root cause: Claude Code determines
CLAUDE_CODE_EXECPATHfromprocess.execPath, which reads/proc/self/exe. When launched asld-linux-x86-64.so.2 ~/.local/bin/claude, the process's/proc/self/exeresolves to the linker, not the claude binary. SoCLAUDE_CODE_EXECPATHgets set to/lib64/ld-linux-x86-64.so.2.The injected grep shim then does:
Which becomes
ARGV0=ugrep /lib64/ld-linux-x86-64.so.2 -G ...— the linker receives-Gas a library name to load, and fails.Fix: Two small compiled pieces:
~/.local/bin/claude-dispatch— a C program that checksargv[0]and dispatches correctly: if called asugrep/bfs/rg, it chains told-linux --argv0 <tool> ~/.local/bin/claude <args>. Otherwise it does a normal launch.~/.local/lib/claude-preload.so— anLD_PRELOADlibrary that interceptsreadlink("/proc/self/exe")and returns the dispatch binary path instead of the linker path. This makesCLAUDE_CODE_EXECPATHpoint to the dispatcher.The preload and dispatch are two separate pieces because each solves a different part of the problem: the preload is the only thing that can intercept
/proc/self/exe, and the compiled dispatch binary is the only thing that correctly receivesargv[0]from the shim (a shell script would lose it due to shebang rewriting).Setup:
Replace
YOUR_USERwith your username in both C files.<details>
<summary>claude-dispatch.c</summary>
</details>
<details>
<summary>claude-preload.c</summary>
</details>
Does 2.1.112 work for you on WSL1?
I have been running on 2.1.112 on WSL1 for the past few weeks. Anyone been able to use a newer version?
Not here to spam, but sharing my experience trying to run the latest version: