Agent tool spawns orphan agent when team_name references nonexistent team
Resolved 💬 1 comment Opened Apr 9, 2026 by cbockenstette-commits Closed Apr 10, 2026
Bug
When the Agent tool is called with team_name pointing at a nonexistent team, the tool returns an error message but still spawns the agent. The orphan agent runs to completion and its output never routes back to the caller.
Steps to Reproduce
- Call
Agent(team_name: "my-team", prompt: "do something")where"my-team"does not exist (e.g., becauseTeamCreatesilently renamed it — see related bug) - Observe: error message returned ("Team does not exist")
- Observe:
agent_spawnedevent in activity log — agent runs to completion as orphan - Agent output is lost (never delivered to caller)
Expected Behavior
If the target team does not exist, the Agent call should fail cleanly without spawning any agent.
Actual Behavior
Error message returned AND agent spawned. The orphan runs to completion (observed: 94-162 seconds), consuming tokens with no output delivery.
Impact
- Duplicate work and wasted tokens (observed: 4 agents spawned for work of 2)
- Silent failures — caller believes the call failed but orphan is running
- Compounds with
TeamCreatesilent rename bug: requested name is ignored → subsequent Agent calls with that name fail → orphan spawns
Environment
- Claude Code CLI
- Observed: 2026-04-08
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗