remote-control: child process spawn missing cli.js script path

Resolved 💬 3 comments Opened Feb 25, 2026 by tatti1204 Closed Feb 28, 2026

Bug Description

claude remote-control connects successfully but the session immediately fails with:

Session failed: /opt/homebrew/Cellar/node@22/22.22.0_1/bin/node: bad option: --sdk-url

Root Cause

In cli.js (minified, line ~6316), the RPq() function spawns a child process for bridge sessions:

let $ = ["--print", "--sdk-url", q.sdkUrl, "--session-id", q.sessionId, ...];
let O = BHz(A.execPath, $, { cwd: K, stdio: ["pipe","pipe","pipe"], env: H, windowsHide: true });

Where:

  • BHz = spawn from child_process
  • A.execPath = process.execPath (the Node.js binary, e.g. /opt/homebrew/bin/node)

This results in:

node --print --sdk-url wss://... --session-id ...

Node.js interprets --print as its own eval flag and then rejects --sdk-url as an unknown Node.js option. The cli.js script path is missing from the arguments array.

Expected Behavior

The spawn should include the CLI script path (process.argv[1]) as the first argument:

let O = spawn(A.execPath, [process.argv[1], ...$], { ... });

Which produces:

node /path/to/cli.js --print --sdk-url wss://... --session-id ...

Workaround

Patch cli.js manually:

sed -i '' 's|let O=BHz(A.execPath,\$,{|let O=BHz(A.execPath,[process.argv[1],...$],{|' \
  "$(dirname "$(readlink "$(which claude)")")/cli.js"

Note: this patch is overwritten on update.

Environment

  • Claude Code version: 2.1.53
  • Node.js: v22.22.0 (also reproduced on v25.6.1)
  • OS: macOS (Darwin 25.2.0, arm64)
  • Install method: npm global

View original on GitHub ↗

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