{"record":{"id":"3a4a28781ac66d5f","repo":"microsoft/autogen","slug":"the-participant-topic-types-must-be-unique","errorCode":null,"errorMessage":"The participant topic types must be unique.","messagePattern":"The participant topic types must be unique\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat_manager.py","lineNumber":66,"sourceCode":"        message_factory: MessageFactory,\n        emit_team_events: bool = False,\n    ):\n        super().__init__(\n            description=\"Group chat manager\",\n            sequential_message_types=[\n                GroupChatStart,\n                GroupChatAgentResponse,\n                GroupChatTeamResponse,\n                GroupChatMessage,\n                GroupChatReset,\n            ],\n        )\n        if max_turns is not None and max_turns <= 0:\n            raise ValueError(\"The maximum number of turns must be greater than 0.\")\n        if len(participant_topic_types) != len(participant_descriptions):\n            raise ValueError(\"The number of participant topic types, agent types, and descriptions must be the same.\")\n        if len(set(participant_topic_types)) != len(participant_topic_types):\n            raise ValueError(\"The participant topic types must be unique.\")\n        if group_topic_type in participant_topic_types:\n            raise ValueError(\"The group topic type must not be in the participant topic types.\")\n        self._name = name\n        self._group_topic_type = group_topic_type\n        self._output_topic_type = output_topic_type\n        self._participant_names = participant_names\n        self._participant_name_to_topic_type = {\n            name: topic_type for name, topic_type in zip(participant_names, participant_topic_types, strict=True)\n        }\n        self._participant_descriptions = participant_descriptions\n        self._message_thread: List[BaseAgentEvent | BaseChatMessage] = []\n        self._output_message_queue = output_message_queue\n        self._termination_condition = termination_condition\n        self._max_turns = max_turns\n        self._current_turn = 0\n        self._message_factory = message_factory\n        self._emit_team_events = emit_team_events\n        self._active_speakers: List[str] = []","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat_manager.py#L48-L84","documentation":"Thrown by the BaseGroupChatManager constructor when two or more participants in a group chat team resolve to the same topic type. Topic types are derived from participant names, so this almost always means two agents (or nested teams) in the team share the same name; each participant must map to a unique runtime topic for message routing to be deterministic.","triggerScenarios":"Creating RoundRobinGroupChat, SelectorGroupChat, Swarm, or GraphFlow with a participants list containing two agents with identical .name values; or passing participant_topic_types with duplicates when constructing the manager directly. Note names are compared case-sensitively ('Agent1' vs 'agent1' are distinct).","commonSituations":"Agents instantiated from the same class/config in a loop without assigning unique names; dynamically generated participant lists where names come from data; refactoring a config file where an agent was duplicated; copy-pasting an agent definition.","solutions":["Give every agent/team in the participants list a unique name= argument when constructing them.","If participants are built dynamically, assert uniqueness before team construction (see validation code) and append an index or hash on collision.","Check nested teams: a Team used as a participant carries its own name and must not collide with sibling names."],"exampleFix":"// before\nagents = [AssistantAgent(name=\"writer\", model_client=client), CodeExecutorAgent(name=\"writer\")]  # both 'writer'\nteam = RoundRobinGroupChat(participants=agents)\n\n// after\nagents = [AssistantAgent(name=\"writer\", model_client=client), CodeExecutorAgent(name=\"reviewer\")]\nteam = RoundRobinGroupChat(participants=agents)","handlingStrategy":"validation","validationCode":"names = [a.name for a in participants]\nif len(set(names)) != len(names):\n    dupes = sorted({n for n in names if names.count(n) > 1})\n    raise ValueError(f\"Duplicate participant names: {dupes}\")\nteam = RoundRobinGroupChat(participants)","typeGuard":"def has_unique_participant_names(participants: Sequence[ChatAgent | Team]) -> bool:\n    names = [p.name for p in participants]\n    return len(set(names)) == len(names)","tryCatchPattern":null,"preventionTips":["Always pass an explicit, unique name= to every agent constructor.","For dynamically built rosters, derive names from an indexed template (f\"worker_{i}\").","Assert name uniqueness in a unit test that covers team construction."],"tags":["group-chat","configuration","validation","naming"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}