microsoft/semantic-kernel · error · ValueError

The members list cannot be empty.

Error message

The members list cannot be empty.

What it means

OrchestrationBase requires at least one agent to coordinate; an empty members list has no one to route messages to, so the constructor rejects it. This is the first validation in __init__ and applies to every orchestration subclass (Magentic, GroupChat, Sequential, etc.).

Source

Thrown at python/semantic_kernel/agents/orchestration/orchestration_base.py:116

        agent_response_callback: Callable[[DefaultTypeAlias], Awaitable[None] | None] | None = None,
        streaming_agent_response_callback: Callable[[StreamingChatMessageContent, bool], Awaitable[None] | None]
        | None = None,
    ) -> None:
        """Initialize the orchestration base.

        Args:
            members (list[Agent]): The list of agents to be used.
            name (str | None): A unique name of the orchestration. If None, a unique name will be generated.
            description (str | None): The description of the orchestration. If None, use a default description.
            input_transform (Callable | None): A function that transforms the external input message.
            output_transform (Callable | None): A function that transforms the internal output message.
            agent_response_callback (Callable | None): A function that is called when a full response is produced
                by the agents.
            streaming_agent_response_callback (Callable | None): A function that is called when a streaming response
                is produced by the agents.
        """
        if not members:
            raise ValueError("The members list cannot be empty.")
        self._members = members

        self.name = name or f"{self.__class__.__name__}_{uuid.uuid4().hex}"
        self.description = description or "A multi-agent orchestration."

        self._input_transform = input_transform or self._default_input_transform
        self._output_transform = output_transform or self._default_output_transform

        self._agent_response_callback = agent_response_callback
        self._streaming_agent_response_callback = streaming_agent_response_callback

    def _set_types(self) -> None:
        """Set the external input and output types from the class arguments.

        This method can only be run after the class has been initialized because it relies on the
        `__orig_class__` attributes to determine the type parameters.

        This method will first try to get the type parameters from the class itself. The `__orig_class__`

View on GitHub (pinned to c028a0c7dc)

Solutions

  1. Provide at least one Agent instance in members.
  2. Validate the members list is non-empty before constructing the orchestration.
  3. For Magentic, also remember each member needs a description (separate check).

Example fix

// before
orch = MagenticOrchestration(members=[], manager=manager)  # raises

// after
agents = [ChatCompletionAgent(name="A", description="A: ...", service=svc)]
orch = MagenticOrchestration(members=agents, manager=manager)
Defensive patterns

Strategy: validation

Validate before calling

if not members:
    raise ValueError("At least one agent is required.")
orch = MagenticOrchestration(members=members, manager=manager)

Type guard

def has_members(members) -> bool:
    return bool(members) and len(members) >= 1

Prevention

When it happens

Trigger: Constructing any orchestration with `members=[]` (an empty list). Also if members resolves to an empty iterable/falsy value.

Common situations: Building the members list dynamically and it happened to be empty (filtered out all agents). Passing members before populating it. Copy-paste scaffolding with a placeholder empty list.

Related errors


AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13). Data as JSON: /api/errors/63aa72220b91e82c. Report an issue: GitHub.