claude-code - 💡(How to fix) Fix [BUG] WSL2: Claude Code 2.1.118 crashes on startup - ENOEXEC when spawning reg.exe [3 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#52426Fetched 2026-04-24 06:07:35
View on GitHub
Comments
3
Participants
3
Timeline
10
Reactions
3
Author
Timeline (top)
labeled ×5commented ×3closed ×1cross-referenced ×1

Error Message

Error message ENOEXEC: unknown error, posix_spawn '/mnt/c/Windows/System32/reg.exe' Claude Code should handle gracefully the case where reg.exe cannot be executed in WSL2 (catch the error silently and continue startup), instead of crashing immediately. Version 2.1.117 handled this correctly.

Error Messages/Logs

ENOEXEC: unknown error, posix_spawn '/mnt/c/Windows/System32/reg.exe' 6. Claude Code crashes immediately with ENOEXEC error

Fix Action

Fix / Workaround

Workaround Downgrade to 2.1.117: npm install -g @anthropic-ai/[email protected]

  • reg.exe is accessible via WSL2 interop at /mnt/c/Windows/System32/reg.exe
  • Claude Code calls reg.exe using its absolute Windows path directly (not via PATH), so workarounds like PATH manipulation or fake wrappers don't work
  • Workaround: downgrade to 2.1.117 npm install -g @anthropic-ai/[email protected]
  • The error also occurs during installation (curl -fsSL https://claude.ai/install.sh | bash)

Code Example

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)
      at new Promise (1:11)
      at gl6 (/$bunfs/root/src/entrypoints/cli.js:188:1422)
      at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:188:1602)
      at $W$ (/$bunfs/root/src/entrypoints/cli.js:188:1822)
      at Ql6 (/$bunfs/root/src/entrypoints/cli.js:188:1861)
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?

Environment

  • OS: WSL2 Ubuntu (kernel 5.15.153.1-microsoft-standard-WSL2)
  • Windows: Windows 10/11
  • Claude Code version: 2.1.118
  • Bun version: 1.3.13 (Linux x64 baseline)

What happens Claude Code 2.1.118 crashes immediately on startup with ENOEXEC when trying to spawn reg.exe using its absolute Windows path. The previous version 2.1.117 works fine.

Error message 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)

Expected behavior Claude Code should handle gracefully the case where reg.exe cannot be executed in WSL2, instead of crashing. Version 2.1.117 handled this correctly.

Workaround Downgrade to 2.1.117: npm install -g @anthropic-ai/[email protected]

What Should Happen?

Claude Code should handle gracefully the case where reg.exe cannot be executed in WSL2 (catch the error silently and continue startup), instead of crashing immediately. Version 2.1.117 handled this correctly.

Error Messages/Logs

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)
      at new Promise (1:11)
      at gl6 (/$bunfs/root/src/entrypoints/cli.js:188:1422)
      at <anonymous> (/$bunfs/root/src/entrypoints/cli.js:188:1602)
      at $W$ (/$bunfs/root/src/entrypoints/cli.js:188:1822)
      at Ql6 (/$bunfs/root/src/entrypoints/cli.js:188:1861)
Bun v1.3.13 (Linux x64 baseline)

Steps to Reproduce

  1. Install WSL2 with Ubuntu on Windows
  2. Ensure Windows PATH is accessible from WSL2 (default behavior)
  3. Confirm reg.exe is visible: which reg.exe → /mnt/c/Windows/system32/reg.exe
  4. Install Claude Code 2.1.118: npm install -g @anthropic-ai/[email protected]
  5. Run: claude
  6. Claude Code crashes immediately with ENOEXEC error

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

2.1.117

Claude Code Version

2.1.118

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

  • reg.exe is accessible via WSL2 interop at /mnt/c/Windows/System32/reg.exe
  • Claude Code calls reg.exe using its absolute Windows path directly (not via PATH), so workarounds like PATH manipulation or fake wrappers don't work
  • Workaround: downgrade to 2.1.117 npm install -g @anthropic-ai/[email protected]
  • The error also occurs during installation (curl -fsSL https://claude.ai/install.sh | bash)

extent analysis

TL;DR

Downgrade to Claude Code version 2.1.117 to avoid the ENOEXEC error when trying to spawn reg.exe.

Guidance

  • The issue seems to be related to the way Claude Code 2.1.118 handles the execution of reg.exe in WSL2, which is not compatible with the current setup.
  • To verify the issue, follow the steps to reproduce provided in the issue description and check if downgrading to 2.1.117 resolves the problem.
  • Consider checking the differences in how reg.exe is executed between versions 2.1.117 and 2.1.118 to understand the root cause of the issue.
  • If downgrading is not a viable long-term solution, investigate alternative ways to handle the execution of reg.exe in WSL2, such as using a different path or wrapper.

Notes

The provided workaround of downgrading to 2.1.117 suggests that the issue is specific to version 2.1.118, and resolving the issue may require changes to how Claude Code handles reg.exe execution in WSL2.

Recommendation

Apply the workaround by downgrading to version 2.1.117, as it is a known working version that handles the execution of reg.exe correctly in WSL2.

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