claude remote-control fails on Windows: node.exe receives --sdk-url as node flag

Resolved 💬 2 comments Opened Feb 25, 2026 by entrohub Closed Mar 25, 2026

Bug Description

claude remote-control fails immediately on Windows. The spawned child process passes application-level arguments (--sdk-url, --session-id, etc.) directly to node.exe without including the cli.js script path, causing Node.js to reject them as unknown flags.

Error Output

[13:43:22] Session failed: C:\Program Files\nodejs\node.exe: bad option: --sdk-url session_01942vYNGJaLGQwjasDevXhX

Root Cause

In the minified cli.js, the remote-control bridge spawns a child process like:

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

On Windows, A.execPath resolves to the Node.js binary (C:\Program Files\nodejs\node.exe), but the args array $ only contains application-level flags — the path to cli.js is missing. Node.js then interprets --sdk-url as its own flag and rejects it.

This likely works on macOS/Linux because execPath resolves to the claude shell wrapper (which internally calls node cli.js "$@"), so all args are correctly forwarded as application args.

Environment

  • OS: Windows 11 Pro (10.0.26200)
  • Shell: Git Bash
  • Node.js: v22.14.0
  • Claude Code: v2.1.56 (installed globally via npm)
  • Install path: C:\Users\<user>\AppData\Roaming\npm\node_modules\@anthropic-ai\claude-code\

Steps to Reproduce

  1. Install Claude Code globally on Windows: npm i -g @anthropic-ai/claude-code
  2. Run claude remote-control
  3. Observe immediate failure with "bad option: --sdk-url"

Expected Behavior

claude remote-control should start successfully and listen for remote connections, same as on macOS/Linux.

Suggested Fix

When spawning the child process on Windows, prepend the cli.js script path to the args array before the application flags, e.g.:

const args = [pathToCli, "--print", "--sdk-url", ...];

Or use process.argv[1] (which points to cli.js) as the script argument when execPath is the Node binary.

View original on GitHub ↗

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