[BUG] Agent tool with team_name returns err=True but still spawns agent, causing silent duplicate launches

Resolved 💬 2 comments Opened Apr 15, 2026 by dennisbb2 Closed May 24, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report (please file separate reports for different bugs)
  • [x] I am using the latest version of Claude Code

What's Wrong?

When using the Agent tool with a team_name parameter, if the team registration step fails (e.g., due to a stale/mismatched team state), the tool returns err=True with "Team does not exist. Call spawnTeam first." — however the background agent process is actually spawned and running.

This causes the orchestrating model to correctly interpret the error as a failed launch and retry, resulting in N duplicate agents consuming quota simultaneously for the same task.

In one session, this caused 3× duplication of 3 impl tasks (9 agent runs instead of 3), consuming ~3× the expected Opus quota in a 6-minute window.

What Should Happen?

Either return success (agent launched, registration optional), or roll back the spawn if registration fails — but never return an error while silently leaving the agent running.

Error Messages/Logs

"Team does not exist. Call spawnTeam first."

Steps to Reproduce

  1. Create a team with TeamCreate
  2. Launch background agents via Agent tool with team_name set
  3. If team state goes stale mid-session, subsequent Agent calls return err=True but still spawn
  4. Model retries → duplicate agents run concurrently

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

2.1.92

Platform

Google Vertex AI

Operating System

Ubuntu/Debian Linux

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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