claude-code - 💡(How to fix) Fix Team name collision across sessions — file-based registry keyed by name, not session [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#49642Fetched 2026-04-17 08:35:24
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×3commented ×2

When two Claude Code sessions on the same machine create teams with the same name, agents from one session join the other session's team. Messages, idle notifications, and shutdown approvals route to the wrong session. The originating session goes silent because its agents are reporting to a different lead.

Root Cause

The team registry is file-based at ~/.claude/teams/{team-name}/config.json, keyed solely by team name. When session B creates a team named "observability", it either overwrites or joins the existing team file created by session A. The leadSessionId in the config determines where messages route, and it points to whichever session last wrote the file.

RAW_BUFFERClick to expand / collapse

Summary

When two Claude Code sessions on the same machine create teams with the same name, agents from one session join the other session's team. Messages, idle notifications, and shutdown approvals route to the wrong session. The originating session goes silent because its agents are reporting to a different lead.

Reproduction

  1. Open two Claude Code sessions under the same user (same ~/.claude/ directory)
  2. In session A, create a team: TeamCreate("observability")
  3. In session B, create a team with the same name: TeamCreate("observability")
  4. Session B spawns agents with team_name: "observability"
  5. Result: The agents join session A's team. All teammate messages (idle notifications, completion reports, shutdown approvals) route to session A. Session B receives nothing.

Root Cause

The team registry is file-based at ~/.claude/teams/{team-name}/config.json, keyed solely by team name. When session B creates a team named "observability", it either overwrites or joins the existing team file created by session A. The leadSessionId in the config determines where messages route, and it points to whichever session last wrote the file.

Observed Impact

  • Agents spawned in one session reported their work to a completely unrelated session
  • The originating session's lead went idle — from its perspective, all agents went silent
  • Shutdown approvals for agents the receiving session never spawned landed in its conversation
  • Had to manually edit the team config JSON to remove stale members before TeamDelete would succeed

Suggested Fix

Key teams by session ID (or session ID + team name) rather than team name alone. Two independent sessions should be able to create teams with the same name without collision. Cross-session team coordination, if desired, should be explicit and opt-in.

Environment

  • Claude Code CLI
  • Two sessions on the same Linux machine, same user, shared ~/.claude/ directory
  • Both sessions used TeamCreate with name "observability" independently

extent analysis

TL;DR

Modify the team registry to key teams by a unique identifier, such as session ID and team name, to prevent collisions between sessions.

Guidance

  • Verify the team registry file location and format to understand how team configurations are stored and updated.
  • Consider modifying the TeamCreate function to accept an additional parameter, such as a session ID, to ensure unique team identifiers.
  • Update the team config JSON file to include the session ID, allowing multiple sessions to create teams with the same name without conflicts.
  • Test the modified team registry and TeamCreate function to ensure correct behavior and prevent message routing issues.

Example

// Updated team config JSON file
{
  "team_name": "observability",
  "session_id": "session-A-123",
  "leadSessionId": "session-A-123",
  "members": [...]
}

Notes

This solution assumes that the team registry is the primary cause of the issue and that modifying the team config JSON file will resolve the problem. However, additional testing and verification may be necessary to ensure that this fix does not introduce new issues.

Recommendation

Apply the suggested fix by modifying the team registry to key teams by a unique identifier, such as session ID and team name, to prevent collisions between sessions. This will allow multiple sessions to create teams with the same name without conflicts and ensure correct message routing.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix Team name collision across sessions — file-based registry keyed by name, not session [2 comments, 2 participants]