[BUG] claude crashes on WSL with ENOEXEC when reading Windows-side managed settings (wslInheritsWindowsSettings)

Resolved 💬 3 comments Opened Apr 23, 2026 by futabato Closed Apr 27, 2026

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?

On WSL, claude crashes at startup with ENOEXEC from posix_spawn because it tries to invoke Windows reg.exe to read managed-policy settings from the Windows registry. The bundled Bun runtime cannot execute a PE binary via WSL's binfmt_misc interop, so the process dies before the UI starts.
strace -f -e execve claude shows Claude Code attempts two registry reads during startup:

  • reg.exe query HKLM\SOFTWARE\Policies\ClaudeCode /v Settings
  • reg.exe query HKCU\SOFTWARE\Policies\ClaudeCode /v Settings

Both execve calls fail with ENOEXEC, and the second failure is promoted to an unhandled exception that terminates the process.
Two issues seem to be stacked here:

When running as a Linux binary inside WSL, Claude Code probably shouldn't be querying the Windows registry at all. reg.exe is only found because WSL imports the Windows PATH by default (appendWindowsPath = true). The Linux-side managed-settings source (/etc/claude-code/managed-settings.json) is what ought to be consulted.
Even if a registry read were intended, a failed spawn of reg.exe is not a fatal condition and should be caught so startup can proceed.

What Should Happen?

claude should start successfully under WSL. Ideally the Windows registry lookup is skipped entirely on Linux (including WSL), and at minimum any ENOEXEC / spawn failure from reg.exe should be caught so managed-settings discovery degrades gracefully.

Error Messages/Logs

[pid 898782] execve("/mnt/c/Windows/System32/reg.exe",
  ["/mnt/c/Windows/System32/reg.exe", "query",
   "HKLM\\SOFTWARE\\Policies\\ClaudeCode", "/v", "Settings"],
  0x... /* 42 vars */) = -1 ENOEXEC (Exec format error)
[pid 898782] +++ exited with 127 +++
[pid 898783] execve("/mnt/c/Windows/System32/reg.exe",
  ["/mnt/c/Windows/System32/reg.exe", "query",
   "HKCU\\SOFTWARE\\Policies\\ClaudeCode", "/v", "Settings"],
  0x... /* 42 vars */) = -1 ENOEXEC (Exec format error)
[pid 898783] +++ exited with 127 +++

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. On a WSL (Ubuntu) instance with default /etc/wsl.conf (i.e. appendWindowsPath = true, so /mnt/c/Windows/System32 is on $PATH and reg.exe is resolvable by name)
  2. Install Claude Code: npm install -g @anthropic-ai/claude-code
  3. In any directory, run claude
  4. The process crashes with the stack trace shown above before anything interactive appears

Confirmed via strace -f -e execve claude that the failing spawn targets /mnt/c/Windows/System32/reg.exe for HKLM\SOFTWARE\Policies\ClaudeCode then HKCU\SOFTWARE\Policies\ClaudeCode, both with value name Settings.
Workaround: adding the following to /etc/wsl.conf and running wsl --shutdown from Windows removes reg.exe from $PATH and lets claude start:

[interop]
appendWindowsPath = false

This is undesirable for users who rely on invoking Windows tools from WSL by name.

Claude Model

Not sure / Multiple models

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.118 (Claude Code)

Platform

Anthropic API

Operating System

Other Linux

Terminal/Shell

WSL (Windows Subsystem for Linux)

Additional Information

  • WSL Version: 2.4.11.0
  • Description: Ubuntu 24.04.4 LTS
  • Node.js: v24.1.0 (installed via asdf); the claude binary is a Bun-compiled standalone (Bun v1.3.13 Linux x64 baseline) despite being installed through npm
  • Binary path: ~/.asdf/installs/nodejs/24.1.0/bin/claude
  • Full strace -f -e execve claude log available on request

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗