{"record":{"id":"de20c774c0a2dc46","repo":"microsoft/autogen","slug":"the-number-of-participant-topic-types-agent-types","errorCode":null,"errorMessage":"The number of participant topic types, agent types, and descriptions must be the same.","messagePattern":"The number of participant topic types, agent types, and descriptions must be the same\\.","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":64,"sourceCode":"        termination_condition: TerminationCondition | None,\n        max_turns: int | None,\n        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","sourceCodeStart":46,"sourceCodeEnd":82,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat_manager.py#L46-L82","documentation":"The group chat manager requires participant_topic_types and participant_descriptions to be parallel lists of identical length — each participant needs exactly one topic and one description. Internally they are zipped with strict=True, so any length mismatch is rejected up front.","triggerScenarios":"Constructing a group chat manager (or a custom team/flow that instantiates one) where descriptions were built from a different source than the agents, leaving len(participant_descriptions) != len(participant_topic_types) — e.g. one agent added without a matching description string.","commonSituations":"Custom team subclasses or GraphFlow-style code that assembles the manager's arguments by hand; config-driven setups where the agents list and descriptions list drift out of sync.","solutions":["Build descriptions from the participants themselves so lengths cannot diverge: [a.description for a in participants].","Add or remove entries until both lists match, one per participant.","Add an assertion before manager construction: assert len(topics) == len(descriptions)."],"exampleFix":"# before\nmanager = MyManager(\n    participant_topic_types=topics,          # 3 entries\n    participant_descriptions=descriptions,   # 2 entries -> ValueError\n)\n\n# after\nmanager = MyManager(\n    participant_topic_types=topics,\n    participant_descriptions=[a.description for a in participants],  # same length\n)","handlingStrategy":"validation","validationCode":"assert len(participant_topic_types) == len(participant_descriptions), (\n    f\"length mismatch: {len(participant_topic_types)} topics vs {len(participant_descriptions)} descriptions\"\n)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Derive descriptions and topics from the same participants list: [p.name for p in agents] and [p.description for p in agents].","Never hand-assemble parallel metadata lists from separate config sources.","Zip with strict=True in your own code to catch divergence early."],"tags":["python","autogen","group-chat-manager","validation","custom-team"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}