claude-code - 💡(How to fix) Fix [BUG] ENOEXEC error when running Claude Code on WSL2 (Bun v1.3.13 regression) [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#52455Fetched 2026-04-24 06:06:47
View on GitHub
Comments
2
Participants
3
Timeline
8
Reactions
0
Author
Timeline (top)
labeled ×4commented ×2closed ×1unlabeled ×1

Error Message

662 | var file = this.spawnfile = options.file, spawnargs; 663 | if (options.args === @undefined) 664 | spawnargs = this.spawnargs = []; 665 | else 666 | validateArray(options.args, "options.args"), spawnargs = this.spawnargs = options.args; 667 | if (this.#handle = Bun.spawn({ ^ ENOEXEC: unknown error, posix_spawn '/mnt/c/Windows/System32/reg.exe' path: "/mnt/c/Windows/System32/reg.exe", syscall: "posix_spawn", errno: -8, code: "ENOEXEC"

  at spawn (node:child_process:667:35)
  at spawn (node:child_process:14:39)
  at execFile (node:child_process:59:20)
  at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:188:1452)

Bun v1.3.13 (Linux x64 baseline)

Root Cause

Bun v1.3.13 introduced a regression where it tries to call reg.exe (Windows registry tool) via posix_spawn from within WSL2. Since /mnt/c/Windows/System32/reg.exe is a Windows PE executable, the Linux kernel cannot execute it and returns ENOEXEC.

Fix Action

Fix / Workaround

Workarounds attempted: Global Bun Downgrade: Failed (Claude uses its own bundled v1.3.13).

Code Example

## Error


662 |     var file = this.spawnfile = options.file, spawnargs;
663 |     if (options.args === @undefined)
664 |       spawnargs = this.spawnargs = [];
665 |     else
666 |       validateArray(options.args, "options.args"), spawnargs = this.spawnargs = options.args;
667 |       if (this.#handle = Bun.spawn({
             ^
ENOEXEC: unknown error, posix_spawn '/mnt/c/Windows/System32/reg.exe'
    path: "/mnt/c/Windows/System32/reg.exe",
 syscall: "posix_spawn",
   errno: -8,
    code: "ENOEXEC"

      at spawn (node:child_process:667:35)
      at spawn (node:child_process:14:39)
      at execFile (node:child_process:59:20)
      at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:188:1452)

Bun v1.3.13 (Linux x64 baseline)
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Root Cause

Bun v1.3.13 introduced a regression where it tries to call reg.exe (Windows registry tool) via posix_spawn from within WSL2. Since /mnt/c/Windows/System32/reg.exe is a Windows PE executable, the Linux kernel cannot execute it and returns ENOEXEC.

What Should Happen?

Claude should open the TUI

Error Messages/Logs

## Error


662 |     var file = this.spawnfile = options.file, spawnargs;
663 |     if (options.args === @undefined)
664 |       spawnargs = this.spawnargs = [];
665 |     else
666 |       validateArray(options.args, "options.args"), spawnargs = this.spawnargs = options.args;
667 |       if (this.#handle = Bun.spawn({
             ^
ENOEXEC: unknown error, posix_spawn '/mnt/c/Windows/System32/reg.exe'
    path: "/mnt/c/Windows/System32/reg.exe",
 syscall: "posix_spawn",
   errno: -8,
    code: "ENOEXEC"

      at spawn (node:child_process:667:35)
      at spawn (node:child_process:14:39)
      at execFile (node:child_process:59:20)
      at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:188:1452)

Bun v1.3.13 (Linux x64 baseline)

Steps to Reproduce

Steps to Reproduce

  1. Install Bun v1.3.13 on WSL2
  2. Install Claude Code via npm install -g @anthropic-ai/claude-code
  3. Run claude — crashes immediately with the error above

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

Workarounds attempted: Global Bun Downgrade: Failed (Claude uses its own bundled v1.3.13).

PATH Mocking: Failed (The binary seems to call the absolute path /mnt/c/Windows/System32/reg.exe).

WSL Interop manual fix: echo ':WSLInterop:M::MZ::/init:PF' | sudo tee /proc/sys/fs/binfmt_misc/register (Only works if the kernel allows re-registration).

Recommended Fix for Users: The only reliable way to bypass this until a new version is released with Bun v1.3.14+ is to force the use of a version that doesn't include the faulty runtime or use npx with an older tag:

Bash Install a previous stable version that uses a different Bun/Node runtime npm install -g @anthropic-ai/[email protected]

All workaounds and Fixes were recommended and implemented by Gemini as at the moment Claude was dead :)

extent analysis

TL;DR

Downgrade Claude Code to version 0.2.23 to bypass the issue with Bun v1.3.13.

Guidance

  • The error occurs because Bun v1.3.13 tries to execute a Windows executable (reg.exe) via posix_spawn within WSL2, which is not supported.
  • To verify the issue, check the error message for ENOEXEC and the path to reg.exe.
  • As a temporary workaround, install an older version of Claude Code using npm install -g @anthropic-ai/[email protected].
  • Note that downgrading Bun itself is not a viable option since Claude Code bundles its own version of Bun.

Example

No code snippet is necessary for this issue, as the solution involves installing a different version of Claude Code.

Notes

The issue is specific to the combination of Bun v1.3.13, WSL2, and Claude Code. The recommended fix is to use an older version of Claude Code that does not include the faulty Bun runtime.

Recommendation

Apply the workaround by downgrading Claude Code to version 0.2.23, as this is the most reliable solution until a new version with Bun v1.3.14+ is released.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] ENOEXEC error when running Claude Code on WSL2 (Bun v1.3.13 regression) [2 comments, 3 participants]