Attaching to a stopped/idle background agent crashes the worker with contradictory "currently running as a background agent" error

Open 💬 7 comments Opened Jul 3, 2026 by jmsundar

Summary

Attaching to a stopped/idle background agent session from the claude agents (agent view / FleetView) list crashes the worker with a self-contradictory error: the stopped session reports that it is "currently running as a background agent." Sessions with a running icon attach fine; every session with a stopped/idle icon fails the same way.

Environment

  • Claude Code version: 2.1.199
  • OS: macOS (Darwin 25.5.0)
  • Install: native (~/.local/share/claude/versions/2.1.199)

Steps to reproduce

  1. Open the agent list with claude agents.
  2. Select a session showing the running icon (animated star) and press Enter — attaches fine.
  3. Select any session showing the stopped/idle icon and press Enter to attach.

Actual behavior

Attaching to the stopped/idle session fails with:

Session <session-id> is currently running as a background agent (bg). Use `claude agents` to find and attach to it, or add --fork-session to branch off a copy.

[worker crashed (exit 1 — exit_with_message) — respawning…]

This is contradictory — the session is displayed as stopped/idle, yet the message claims it is "currently running as a background agent." It reproduces for every stopped/idle session, consistently. Running sessions (star icon) are unaffected.

The same message appears when trying claude --resume <session-id> on such a session.

Expected behavior

Pressing Enter on a stopped/idle background session should wake/restart its process and attach, rather than emitting a "currently running" error and crashing the worker.

Workaround

claude --resume <session-id> --fork-session successfully branches a copy and opens it. However, if that forked session is then stopped (Ctrl+X), re-attaching to it fails again with the same error under a new session ID — so each stop produces another session that cannot be re-attached from the list.

View original on GitHub ↗

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