CLI rejects --session-id flag: 'unknown option --session-id'
Resolved 💬 2 comments Opened Mar 19, 2026 by yasserstudio Closed Apr 16, 2026
Description
Running claude --session-id <uuid> sometimes fails with:
error: unknown option '--session-id'
Despite claude --help listing --session-id <uuid> as a valid option.
Environment
- Claude Code:
@anthropic-ai/claude-code@2.1.79(latest, installed via npm) - macOS Darwin 25.3.0
- Node: v20.20.0 (via nvm)
- Terminal: cmux (Ghostty-based terminal that wraps the
claudecommand to inject--session-idfor session tracking)
Context
The cmux terminal app uses a shim that calls:
claude --session-id <uuid> --settings '{"hooks":{...}}'
This works from some terminal contexts but fails from fresh terminal tabs with the unknown option error. Running the exact same command manually with a valid UUID works fine:
claude --session-id "97cb65d0-4972-479c-92d7-11df15dcaaad" --print "hello"
# Returns: Error: Invalid session ID. Must be a valid UUID.
# (correctly validates UUID format rather than rejecting the flag)
Steps to reproduce
- Install Claude Code via npm:
npm install -g @anthropic-ai/claude-code - Open a new terminal
- Run:
claude --session-id "$(uuidgen | tr '[:upper:]' '[:lower:]')" - Sometimes works, sometimes returns
error: unknown option '--session-id'
This may be a Commander.js parsing issue or a timing/initialization issue where the CLI hasn't registered all options before parsing argv.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗