remote-control: child session spawn passes args to Node binary instead of claude script

Resolved 💬 3 comments Opened Feb 26, 2026 by oddrap Closed Mar 1, 2026

Bug Description

claude remote-control fails immediately when spawning a child session. The child process arguments (--print, --sdk-url, etc.) are passed directly to the Node binary (process.execPath) without including the claude script path as the first argument.

Error

$ claude remote-control
[16:13:27] Session started: "Session session_019B998uANBQoWFpcEFF122V"
/opt/homebrew/Cellar/node@22/22.22.0/bin/node: bad option: --sdk-url
[16:13:27] Session failed: /opt/homebrew/Cellar/node@22/22.22.0/bin/node: bad option: --sdk-url session_019B998uANBQoWFpcEFF122V
[16:13:27] Failed to archive session: Not Found

Root Cause

In the bridge session spawner, the child process is spawned as:

// execPath = process.execPath = "/opt/homebrew/Cellar/node@22/22.22.0/bin/node"
let args = ["--print", "--sdk-url", sdkUrl, "--session-id", sessionId, ...];
spawn(execPath, args, { cwd, ... });

Since execPath is the Node binary (not the claude script), Node interprets --print as its own -p flag (evaluate JS expression), then rejects --sdk-url as an unknown Node option.

Confirmed by reproducing the exact error:

$ node --print --sdk-url
node: bad option: --sdk-url

The fix would be to include the claude script path as the first element of the args array:

spawn(execPath, [claudeScriptPath, "--print", "--sdk-url", ...], { ... });

Environment

  • Claude Code: 2.1.59
  • Node: v22.22.0 (Homebrew, node@22 formula)
  • Platform: macOS Darwin 25.3.0 (Apple Silicon)
  • Install method: npm global (/opt/homebrew/bin/claude)

View original on GitHub ↗

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