{"record":{"id":"8e285ca778f1499c","repo":"microsoft/autogen","slug":"at-least-one-participant-is-required","errorCode":null,"errorMessage":"At least one participant is required.","messagePattern":"At least one participant is required\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py","lineNumber":82,"sourceCode":"    component_type = \"team\"\n\n    def __init__(\n        self,\n        name: str,\n        description: str,\n        participants: List[ChatAgent | Team],\n        group_chat_manager_name: str,\n        group_chat_manager_class: type[SequentialRoutedAgent],\n        termination_condition: TerminationCondition | None = None,\n        max_turns: int | None = None,\n        runtime: AgentRuntime | None = None,\n        custom_message_types: List[type[BaseAgentEvent | BaseChatMessage]] | None = None,\n        emit_team_events: bool = False,\n    ):\n        self._name = name\n        self._description = description\n        if len(participants) == 0:\n            raise ValueError(\"At least one participant is required.\")\n        if len(participants) != len(set(participant.name for participant in participants)):\n            raise ValueError(\"The participant names must be unique.\")\n        self._participants = participants\n        self._base_group_chat_manager_class = group_chat_manager_class\n        self._termination_condition = termination_condition\n        self._max_turns = max_turns\n        self._message_factory = MessageFactory()\n        if custom_message_types is not None:\n            for message_type in custom_message_types:\n                self._message_factory.register(message_type)\n\n        for agent in participants:\n            if isinstance(agent, ChatAgent):\n                for message_type in agent.produced_message_types:\n                    try:\n                        is_registered = self._message_factory.is_registered(message_type)  # type: ignore[reportUnknownArgumentType]\n                        if issubclass(message_type, StructuredMessage) and not is_registered:\n                            self._message_factory.register(message_type)  # type: ignore[reportUnknownArgumentType]","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/python/packages/autogen-agentchat/src/autogen_agentchat/teams/_group_chat/_base_group_chat.py#L64-L100","documentation":"BaseGroupChat's constructor requires at least one participant; an empty list means there is no agent to route messages to, so the team cannot function. This is a fail-fast validation at team construction time.","triggerScenarios":"Creating any group chat team (RoundRobinGroupChat, SelectorGroupChat, GraphFlow, etc.) with participants=[] — commonly when the list is built dynamically (e.g. agents filtered by a condition that matched nothing).","commonSituations":"Programmatically generated agent lists where a filter/config yields zero agents; misconfigured YAML/env-driven setups that produce an empty roster; refactor that moved agent creation after team construction.","solutions":["Pass at least one ChatAgent or Team: RoundRobinGroupChat([assistant]).","If agents are generated dynamically, guard with `if not agents: raise/log` before constructing the team.","Check the upstream config/filter that produced the empty list."],"exampleFix":"# before\nteam = RoundRobinGroupChat(participants=agents)  # agents == []\n\n# after\nassert agents, \"at least one agent is required\"\nteam = RoundRobinGroupChat(participants=agents)","handlingStrategy":"validation","validationCode":"if not participants:\n    raise SystemExit(\"config error: no agents configured\")\nteam = RoundRobinGroupChat(participants)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fail with a clear config message when dynamically built agent lists are empty.","Unit-test team construction with the same config loading path used in production.","Treat an empty roster as a configuration bug, not a valid state."],"tags":["python","autogen","group-chat","validation","constructor"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}