You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug] windows: claude runtime turns fail with spawn EINVAL (CLAUDE_CODE_EXECUTABLE set to a .cmd shim) #2397
on windows, every turn from a claude code agent fails with -32603 internal error, and the hidden detail is spawn EINVAL. the desktop sets CLAUDE_CODE_EXECUTABLE to the claude.cmd npm shim, and the adapter spawns it without shell: true. node >= 20.12 / 24 refuses to spawn a .cmd/.bat without a shell (the cve-2024-27980 hardening), so the spawn throws EINVAL. this is a sibling of the .cmd handling in #2247, and separate from the runtime path issue in #2327.
environment
os: windows 11
runtime: claude code, claude cli v2.1.217 (npm global, so the shim is %APPDATA%\npm\claude.cmd)
for the claude runtime, resolve_command("claude") returns the npm shim ...\npm\claude.cmd. the adapter then spawns CLAUDE_CODE_EXECUTABLE, and on node >= 20.12/24 spawning a .cmd without shell: true throws spawn EINVAL.
note also that configure_runtime_cli runs after the user-env writes (runtime.rs ~line 1862, after merged_user_env at ~1859), so users can't override CLAUDE_CODE_EXECUTABLE from edit agent env vars.
reproduction
driving the adapter directly reproduces it:
CLAUDE_CODE_EXECUTABLE=<...>\claude.cmd -> session/new -> {"code":-32603,"message":"Internal error","data":{"details":"spawn EINVAL"}}
CLAUDE_CODE_EXECUTABLE="" -> turn succeeds (adapter falls back to its bundled claude-code)
suggested fixes
on windows, resolve underlying_cli to a spawnable target (prefer a native claude.exe over the .cmd shim), or
spawn the executable with shell: true on windows, or
don't set CLAUDE_CODE_EXECUTABLE to a bare .cmd; leaving it unset makes the adapter use its bundled claude-code, which works fine.
workaround
install claude code's native binary so a real claude.exe is on path (irm https://claude.ai/install.ps1 | iex, lands at %USERPROFILE%\.local\bin\claude.exe). resolve_command prefers .exe over .cmd, so the adapter then spawns a real executable and turns succeed.
Activity
chessing234 commentedon Jul 23, 2026
Fixed in a PR — on Windows we skip
.cmd/.batshims forCLAUDE_CODE_EXECUTABLEso the adapter can use its bundled Claude.