[BUG] CLI treats tmux/worktree operands after -- as options

Open
#111,498 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
Half a day
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
cli

Research direction

Start where the CLI parses argv and runs startup option validation — look for the check that rejects --desktop combined with --worktree/--tmux, then see whether the scan stops at the first bare --. Reproduce with claude --bare --safe-mode --restricted --strict-mcp-config --help --desktop -- --tmux --worktree against the --help-only control, and confirm the quoted single-argument control still passes. Done means both failing invocations print root help and exit 0 while the conflict error still fires for unseparated flags.

Written by the indexing model from the issue text.

Description

area:cli bug has repro platform:windows
What's Wrong?

In the official Windows Claude Code 2.1.329 executable, separate --tmux and --worktree operands after the -- end-of-options marker trigger the Desktop/worktree conflict check. The invocation exits with code 1 without printing help, even though these operands should no longer be parsed as options.

The alternative operands --tmux=classic and -w produce the same failure. These are two spellings of one argument-boundary defect, not separate issues.

What Should Happen?

Startup option checks should stop at the first --. Operands after it must not activate tmux/worktree routing. In the tested help invocations, Claude Code should print root help and exit 0, as the matched controls do.

Steps to Reproduce

Exact argument sequences tested on 2026-11-20:

claude --bare --safe-mode --restricted --strict-mcp-config --help --desktop -- --tmux --worktree
claude --bare --safe-mode --restricted --strict-mcp-config --help --desktop -- --tmux=classic -w

Both return exit 1, empty stdout, and this stderr:

--desktop only opens the Claude Desktop app; it can't be combined with `--worktree` or `--tmux`.

The executable was invoked using Node's spawnSync with an argument array and shell: false. The first failing suffix was:

["--help", "--desktop", "--", "--tmux", "--worktree"]

The four isolation flags shown above preceded it in every case. Each invocation used fresh disposable working, home, configuration, cache, and temporary directories; real user credentials/settings were not passed. API/proxy URLs pointed to loopback port 1, and updater/nonessential traffic settings were disabled. This isolates configuration, but is not an OS filesystem/network sandbox. The shortened command without the isolation flags has not been independently reproduced.

Matched Controls and Results

Every row had the same prefix:

claude --bare --safe-mode --restricted --strict-mcp-config
Remaining arguments Exit Help on stdout Conflict on stderr
--help 0 Yes No
--help --desktop -- literal-a literal-b 0 Yes No
--help --desktop -- --tmux --worktree 1 No Yes
--help --desktop -- --tmux=classic -w 1 No Yes
--help --desktop -- "--tmux --worktree" 0 Yes No

In the final control, the quoted text is one argument; it is not an equivalent invocation or a general workaround. It helps distinguish exact-token scanning from searching text within an operand.

All five invocations completed in approximately 1.7–2.2 seconds, with no process-launch errors or timeouts: three passing controls and two contract mismatches. Independent review of the recorded argv arrays, exits, and raw streams confirmed this narrow distinction.

Environment
  • Claude Code: 2.1.329.
  • OS: Windows 11, x86-64, native executable.
  • Launcher: Node.js 26.13.0, direct executable invocation, no shell tokenization.
  • Executable SHA-256: 527162bb4578e3dc36319fa913a530d5dc1f752115a6a4fd139981702bf282d0.
  • Windows Authenticode reported a valid signature from Anthropic, PBC before the study; the probe checked the recorded file hash.
  • Model/API: not exercised; these were help invocations, not conversation requests.
  • Regression/last working version: unknown. Other builds and operating systems were not tested.
Scope and Related Reports

Observed impact is incorrect help handling and a spurious option-conflict error. Desktop launch, tmux operation, worktree creation, normal prompt handling, and security impact were not demonstrated.

Related historical report: #3844 concerns the old SDK omitting the -- separator. Here the separator is explicitly present and a startup option check still treats later operands as flags. A limited search did not identify an exact duplicate of this case.

No leaked source, credentials, private prompts, or home/project paths are included. The installed executable was not modified.

Dominant language
TypeScript
Stars
156k
Forks
25k
Avg merge
16h 19m
Merged PRs (30d)
5

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • No Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from anthropics/claude-code

All issues in anthropics/claude-code

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.