remote-control: session spawn fails on Windows npm installations (process.execPath is node.exe, not claude)

Resolved 💬 3 comments Opened Mar 1, 2026 by tkerns226 Closed Mar 5, 2026

Bug Description

claude remote-control connects to the bridge successfully but fails immediately when spawning a session on Windows with npm-installed Claude Code.

Error

Session failed: C:\Program Files\nodejs\node.exe: bad option: --sdk-url session_01RPbu775xcV9zxSadMZRnJH

Root Cause

The bridge session spawner uses process.execPath as the executable:

// In the bridge session spawner:
execPath: process.execPath  // → C:\Program Files\nodejs\node.exe

It then spawns:

node.exe --print --sdk-url <url> --session-id <id> --input-format stream-json ...

Node.js rejects --sdk-url as an unknown Node option. The cli.js path is never included in the args, so Node doesn't know it should be running Claude Code.

This works on native/standalone installations where process.execPath is the Claude binary itself, but breaks on npm installations where process.execPath is always the Node.js runtime.

Reproduction

  1. Install Claude Code via npm: npm install -g @anthropic-ai/claude-code
  2. Run: claude remote-control
  3. Connect from claude.ai/code and start a session
  4. Session immediately fails with the bad option: --sdk-url error

Environment

  • OS: Windows 10 (10.0.19045)
  • Claude Code: v2.1.63 (npm global install)
  • Node.js: v22.x at C:\Program Files\nodejs\node.exe

Workaround

Install via the native Windows installer instead of npm. The native binary (~/.claude/bin/claude.exe) sets process.execPath to itself, so the bridge spawn works correctly.

Additional Note

There is a secondary issue: when running claude remote-control from within a Claude Code terminal session, the CLAUDECODE=1 environment variable is inherited. The bridge-spawned child sessions hit the nested session check and are rejected, even though they are intentional child sessions (not truly nested). The remote-control subcommand is not in the kCz bypass list. Adding it (or stripping CLAUDECODE from the child env) would fix this.

View original on GitHub ↗

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