[BUG] Global --dangerously-skip-permissions before a subcommand is parsed as a prompt, breaking daemon (re)spawn for 'claude agents' after auto-update
Summary
When --dangerously-skip-permissions is passed before a subcommand, the
subcommand is not routed — it is swallowed and treated as a prompt, starting
a normal interactive session instead. This also breaks the background daemon's
(re)spawn path: a bypass-permissions claude agents client cannot cold-spawn the
supervisor, so after an auto-update (which shuts the daemon down to reload the new
binary) the agent view is stuck at opening… with:
Couldn't reach the background service (not running) — run 'claude daemon status'
Environment
- Claude Code: 2.1.197 (regressed since ~2.1.196; 2.1.195 worked)
- OS: macOS 15 (Darwin 25.5.0), Apple Silicon (arm64)
- Install: npm global, binary at
/opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/bin/claude.exe
Reproduction (parser bug — minimal)
Call the native binary directly (no shell alias involved):
# flag-free → routes correctly, prints daemon status
$ .../bin/claude.exe daemon status
not running
...
# same command with the flag in FRONT → "daemon status" is treated as a PROMPT,
# opening a normal interactive session instead of running the daemon subcommand
$ .../bin/claude.exe --dangerously-skip-permissions daemon status
<starts an interactive Claude session>
Inconsistency: with the flag in front, agents is still recognized, but daemon
is not — only daemon gets swallowed.
Impact on claude agents (the real-world failure)
- Auto-updater replaces the binary → the running supervisor logs
binary ... changed — self-restarting for upgrade and shuts down.
- Respawn is client-triggered. The user launches
claude agentswith
--dangerously-skip-permissions (a supported combo).
- The agent view propagates the bypass flag into its internal
daemon run
spawn in the leading position → the parser bug fires → no daemon, no
control.sock, nothing in daemon.log → sessions hang at opening….
Flag position does not matter: claude agents --dangerously-skip-permissions
(flag after the subcommand) connects fine to an already-running daemon, but still
fails to cold-spawn one. Only a fully flag-free client (claude daemon run /claude agents with no flag) cold-spawns the supervisor.
Expected
- A global flag before a subcommand should not turn the subcommand into a prompt.
- A bypass-permissions client should be able to cold-spawn the background daemon.
Workaround
Ensure a flag-free daemon exists first, then attach the flagged agent view:claude daemon status || (claude daemon run &) ; claude agents --dangerously-skip-permissions
Showing cached comments. Read the full discussion on GitHub ↗
3 Comments
Found 3 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
Confirming this on a native-installer setup (binary at
~/.local/bin/claude, not npm-global), so the parser bug isn't packaging-specific.Environment: Claude Code 2.1.198, macOS Darwin 25.5.0 (arm64),
--dangerously-skip-permissionsused globally. Theclaude agentsviewer hangs with "Couldn't reach the background service (not running)".It reproduced on two consecutive auto-updates and is still broken in 2.1.198:
2.1.196 → 2.1.197(Jun 30) and2.1.197 → 2.1.198(Jul 1).~/.claude/daemon.logfingerprint both times, the shutdown fires but no supervisor comes back:claude daemon statusthen showsnot running+control.sock: unreachable (ENOENT)+ stale workers in roster.json, and relaunching the flagged viewer can't cold-spawn a replacement, matching your root cause.Corroborating the "regressed since ~2.1.196" note: this log has ~30 auto-upgrades from 2.1.140 → 2.1.196 (May 13 - Jun 29) that ALL self-restarted cleanly within ~0.2-3s (
origin=transient); the first failures appear at 196→197 and 197→198, lining the break up precisely with 2.1.197.Manual recovery that works:
claude daemon stop --anythen relaunch. Your "keep a flag-free daemon alive first" workaround also holds up here, a flagged viewer attaches fine, only cold-spawn is broken.Could not reproduce on v2.1.233 (macOS, Apple Silicon).
Steps:
claude daemon status→ prints daemon status and exits.claude --dangerously-skip-permissions daemon status→ also prints daemon status and exits; no interactive session starts.claude --dangerously-skip-permissions daemon --help→ prints thedaemonsubcommand help.Observed: with the flag in front,
daemon statusis routed to the daemon subcommand, same output as without the flag.Expected: same.
Assessment: This was a genuine regression, introduced around v2.1.196 and fixed in v2.1.199 — see the changelog entry "Fixed
claude --dangerously-skip-permissions daemon <subcommand>being treated as a chat prompt instead of running the subcommand" (https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md, https://github.com/anthropics/claude-code/releases/tag/v2.1.199). A leading--dangerously-skip-permissionsor--allow-dangerously-skip-permissionsis now skipped before routingdaemon <subcommand>, so aliases likealias claude='claude --dangerously-skip-permissions'no longer break the daemon respawn after an auto-update. Closing as fixed; please comment if it recurs on v2.1.199 or later, including the output ofclaude daemon status.🤖 Generated with Claude Code