[BUG] Global --dangerously-skip-permissions before a subcommand is parsed as a prompt, breaking daemon (re)spawn for 'claude agents' after auto-update

Status Fixed / completed
Reported on v2.1.197
Maintainer reply ✓ Yes — bcherny
Activity 4 comments · opened Jul 1, 2026 · closed Aug 15, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

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)

  1. Auto-updater replaces the binary → the running supervisor logs

binary ... changed — self-restarting for upgrade and shuts down.

  1. Respawn is client-triggered. The user launches claude agents with

--dangerously-skip-permissions (a supported combo).

  1. 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

View original on GitHub ↗

3 Comments

github-actions[bot] · 3 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/62332
  2. https://github.com/anthropics/claude-code/issues/36808
  3. https://github.com/anthropics/claude-code/issues/28970

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

evolsb · 3 months ago

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-permissions used globally. The claude agents viewer 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) and 2.1.197 → 2.1.198 (Jul 1).

~/.claude/daemon.log fingerprint both times, the shutdown fires but no supervisor comes back:

[supervisor] binary at ~/.local/bin/claude changed (.../2.1.197 → .../2.1.198) — self-restarting for upgrade
[supervisor] shutting down (cause=upgrade, uptime=87303s, leases=6, live_workers=3)
<no "─── daemon start ───" line follows>

claude daemon status then shows not 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 --any then relaunch. Your "keep a flag-free daemon alive first" workaround also holds up here, a flagged viewer attaches fine, only cold-spawn is broken.

bcherny collaborator · 2 months ago

Could not reproduce on v2.1.233 (macOS, Apple Silicon).

Steps:

  1. claude daemon status → prints daemon status and exits.
  2. claude --dangerously-skip-permissions daemon status → also prints daemon status and exits; no interactive session starts.
  3. claude --dangerously-skip-permissions daemon --help → prints the daemon subcommand help.

Observed: with the flag in front, daemon status is routed to the daemon subcommand, same output as without the flag.
Expected: same.

$ claude --version
2.1.233 (Claude Code)
$ claude --dangerously-skip-permissions daemon status
not running

bg sessions:
  sock dir:     /tmp/cc-daemon-502/...
  control.sock: reachable
  ...

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-permissions or --allow-dangerously-skip-permissions is now skipped before routing daemon <subcommand>, so aliases like alias 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 of claude daemon status.

🤖 Generated with Claude Code

Showing cached comments. Read the full discussion on GitHub ↗