microsoft/autogen · error · ValueError
The participant names must be unique.
Error message
The participant names must be unique.
What it means
Participant names must be unique inside a group chat team because names are used as topic types and message-routing keys. A duplicate name would make message delivery ambiguous, so the constructor rejects it immediately.
Source
Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py:84
def __init__(
self,
name: str,
description: str,
participants: List[ChatAgent | Team],
group_chat_manager_name: str,
group_chat_manager_class: type[SequentialRoutedAgent],
termination_condition: TerminationCondition | None = None,
max_turns: int | None = None,
runtime: AgentRuntime | None = None,
custom_message_types: List[type[BaseAgentEvent | BaseChatMessage]] | None = None,
emit_team_events: bool = False,
):
self._name = name
self._description = description
if len(participants) == 0:
raise ValueError("At least one participant is required.")
if len(participants) != len(set(participant.name for participant in participants)):
raise ValueError("The participant names must be unique.")
self._participants = participants
self._base_group_chat_manager_class = group_chat_manager_class
self._termination_condition = termination_condition
self._max_turns = max_turns
self._message_factory = MessageFactory()
if custom_message_types is not None:
for message_type in custom_message_types:
self._message_factory.register(message_type)
for agent in participants:
if isinstance(agent, ChatAgent):
for message_type in agent.produced_message_types:
try:
is_registered = self._message_factory.is_registered(message_type) # type: ignore[reportUnknownArgumentType]
if issubclass(message_type, StructuredMessage) and not is_registered:
self._message_factory.register(message_type) # type: ignore[reportUnknownArgumentType]
except TypeError:
# Not a class or not a valid subclassable type (skip)View on GitHub (pinned to 027ecf0a37)
Solutions
- Give each agent/team a distinct name: AssistantAgent("coder"), AssistantAgent("reviewer").
- If generating in a loop, suffix with the index: AssistantAgent(f"worker_{i}").
- Add a pre-construction check: names = [p.name for p in participants]; assert len(names) == len(set(names)).
Example fix
# before
team = SelectorGroupChat([AssistantAgent("agent"), AssistantAgent("agent")])
# after
team = SelectorGroupChat([AssistantAgent("researcher"), AssistantAgent("coder")]) Defensive patterns
Strategy: validation
Validate before calling
names = [p.name for p in participants]
if len(names) != len(set(names)):
dupes = {n for n in names if names.count(n) > 1}
raise ValueError(f"duplicate participant names: {dupes}")
team = RoundRobinGroupChat(participants) Prevention
- Generate agent names with an index or role suffix in loops: f"worker_{i}".
- Add a pre-construction uniqueness assertion in code that builds teams from config.
- Remember nested Teams participate in the same namespace.
When it happens
Trigger: Passing two agents constructed with the same name: AssistantAgent("assistant", ...) twice, or an agent named identically to a nested Team participant. The constructor compares len(participants) against the set of participant.name values.
Common situations: Agents created in loops with template names (agent_0 style) where the index was lost; copying example code twice; a nested team whose internal name collides with a top-level agent.
Related errors
- At least one participant is required.
- Task list cannot be empty.
- The maximum number of turns must be greater than 0.
- All agents must have a name.
- All agents must have a unique name.
AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15).
Data as JSON: /api/errors/36b9de67d4021e93.
Report an issue: GitHub.