{"record":{"id":"d17bcbc198e66d7c","repo":"microsoft/autogen","slug":"at-least-one-participant-is-required-for-magentico","errorCode":null,"errorMessage":"At least one participant is required for MagenticOneGroupChat.","messagePattern":"At least one participant is required for MagenticOneGroupChat\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_group_chat.py","lineNumber":142,"sourceCode":"        for participant in participants:\n            if not isinstance(participant, ChatAgent):\n                raise TypeError(f\"Participant {participant} must be a ChatAgent.\")\n        super().__init__(\n            name=name or self.DEFAULT_NAME,\n            description=description or self.DEFAULT_DESCRIPTION,\n            participants=list(participants),\n            group_chat_manager_name=\"MagenticOneOrchestrator\",\n            group_chat_manager_class=MagenticOneOrchestrator,\n            termination_condition=termination_condition,\n            max_turns=max_turns,\n            runtime=runtime,\n            custom_message_types=custom_message_types,\n            emit_team_events=emit_team_events,\n        )\n\n        # Validate the participants.\n        if len(participants) == 0:\n            raise ValueError(\"At least one participant is required for MagenticOneGroupChat.\")\n        self._model_client = model_client\n        self._max_stalls = max_stalls\n        self._final_answer_prompt = final_answer_prompt\n\n    def _create_group_chat_manager_factory(\n        self,\n        name: str,\n        group_topic_type: str,\n        output_topic_type: str,\n        participant_topic_types: List[str],\n        participant_names: List[str],\n        participant_descriptions: List[str],\n        output_message_queue: asyncio.Queue[BaseAgentEvent | BaseChatMessage | GroupChatTermination],\n        termination_condition: TerminationCondition | None,\n        max_turns: int | None,\n        message_factory: MessageFactory,\n    ) -> Callable[[], MagenticOneOrchestrator]:\n        return lambda: MagenticOneOrchestrator(","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_group_chat.py#L124-L160","documentation":"MagenticOneGroupChat.__init__ raises ValueError when the participants sequence is empty. The orchestrator needs at least one agent to nominate as next speaker and to produce the final answer, so an empty roster is rejected.","triggerScenarios":"Constructing MagenticOneGroupChat(participants=[], model_client=client); or passing a list comprehension/generator result that evaluates to empty at call time.","commonSituations":"Dynamically building the participant list from config or filtering, and the filter removes everything; passing a generator expression that was already consumed.","solutions":["Ensure the participants list contains at least one ChatAgent before constructing the team.","If building participants dynamically, validate len(participants) >= 1 and fail fast with your own error message.","Check for accidentally passing a generator instead of a list (participants=list(agents))."],"exampleFix":"# before\nagents = [a for a in pool if a.name.startswith(\"worker\")]  # empty\n team = MagenticOneGroupChat(participants=agents, model_client=client)\n\n# after\nagents = [a for a in pool if a.name.startswith(\"worker\")] or pool[:1]\nteam = MagenticOneGroupChat(participants=agents, model_client=client)","handlingStrategy":"validation","validationCode":"if not participants:\n    raise ValueError(\"Configure at least one ChatAgent before creating the team\")\nteam = MagenticOneGroupChat(participants=participants, model_client=client)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass lists, not generators, as participants.","Validate dynamic participant lists (config-driven) for non-emptiness before team construction."],"tags":["autogen","magentic-one","participants","validation"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}