microsoft/autogen · error · ValueError

At least one participant is required for MagenticOneGroupCha

Error message

At least one participant is required for MagenticOneGroupChat.

What it means

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.

Source

Thrown at python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_magentic_one/_magentic_one_group_chat.py:142

        for participant in participants:
            if not isinstance(participant, ChatAgent):
                raise TypeError(f"Participant {participant} must be a ChatAgent.")
        super().__init__(
            name=name or self.DEFAULT_NAME,
            description=description or self.DEFAULT_DESCRIPTION,
            participants=list(participants),
            group_chat_manager_name="MagenticOneOrchestrator",
            group_chat_manager_class=MagenticOneOrchestrator,
            termination_condition=termination_condition,
            max_turns=max_turns,
            runtime=runtime,
            custom_message_types=custom_message_types,
            emit_team_events=emit_team_events,
        )

        # Validate the participants.
        if len(participants) == 0:
            raise ValueError("At least one participant is required for MagenticOneGroupChat.")
        self._model_client = model_client
        self._max_stalls = max_stalls
        self._final_answer_prompt = final_answer_prompt

    def _create_group_chat_manager_factory(
        self,
        name: str,
        group_topic_type: str,
        output_topic_type: str,
        participant_topic_types: List[str],
        participant_names: List[str],
        participant_descriptions: List[str],
        output_message_queue: asyncio.Queue[BaseAgentEvent | BaseChatMessage | GroupChatTermination],
        termination_condition: TerminationCondition | None,
        max_turns: int | None,
        message_factory: MessageFactory,
    ) -> Callable[[], MagenticOneOrchestrator]:
        return lambda: MagenticOneOrchestrator(

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Ensure the participants list contains at least one ChatAgent before constructing the team.
  2. If building participants dynamically, validate len(participants) >= 1 and fail fast with your own error message.
  3. Check for accidentally passing a generator instead of a list (participants=list(agents)).

Example fix

# before
agents = [a for a in pool if a.name.startswith("worker")]  # empty
 team = MagenticOneGroupChat(participants=agents, model_client=client)

# after
agents = [a for a in pool if a.name.startswith("worker")] or pool[:1]
team = MagenticOneGroupChat(participants=agents, model_client=client)
Defensive patterns

Strategy: validation

Validate before calling

if not participants:
    raise ValueError("Configure at least one ChatAgent before creating the team")
team = MagenticOneGroupChat(participants=participants, model_client=client)

Prevention

When it happens

Trigger: Constructing MagenticOneGroupChat(participants=[], model_client=client); or passing a list comprehension/generator result that evaluates to empty at call time.

Common situations: Dynamically building the participant list from config or filtering, and the filter removes everything; passing a generator expression that was already consumed.

Related errors


AI-assisted analysis of microsoft/autogen@027ecf0a37 (2026-08-15). Data as JSON: /api/errors/d17bcbc198e66d7c. Report an issue: GitHub.