microsoft/autogen · error · ArgumentException

No admin is provided.

Error message

No admin is provided.

What it means

In the obsolete SelectNextSpeakerAsync, when the workflow is absent or produced multiple candidates, the chat asks an admin LLM agent to pick the next speaker. If no admin was provided to the GroupChat constructor, it throws ArgumentException('No admin is provided.'). The admin is required because speaker selection among multiple candidates is delegated to it.

Source

Thrown at dotnet/src/AutoGen.Core/GroupChat/GroupChat.cs:131

        var agentNames = this.agents.Select(x => x.Name).ToList();
        if (this.workflow != null)
        {
            var nextAvailableAgents = await this.workflow.TransitToNextAvailableAgentsAsync(currentSpeaker, conversationHistory);
            agentNames = nextAvailableAgents.Select(x => x.Name).ToList();
            if (agentNames.Count == 0)
            {
                throw new ArgumentException("No next available agents found in the current workflow");
            }

            if (agentNames.Count == 1)
            {
                return this.agents.First(x => x.Name == agentNames.First());
            }
        }

        if (this.admin == null)
        {
            throw new ArgumentException("No admin is provided.");
        }

        var systemMessage = new TextMessage(Role.System,
            content: $@"You are in a role play game. Carefully read the conversation history and carry on the conversation.
The available roles are:
{string.Join(",", agentNames)}

Each message will start with 'From name:', e.g:
From {agentNames.First()}:
//your message//.");

        var conv = this.ProcessConversationsForRolePlay(this.initializeMessages, conversationHistory);

        var messages = new IMessage[] { systemMessage }.Concat(conv);
        var response = await this.admin.GenerateReplyAsync(
            messages: messages,
            options: new GenerateReplyOptions
            {

View on GitHub (pinned to 027ecf0a37)

Solutions

  1. Provide an admin agent (e.g. a GPTAgent with a strong model) when constructing the GroupChat.
  2. If you never want LLM-based selection, ensure the workflow always reduces candidates to exactly one.
  3. Check `chat.admin == null`-equivalent state (or your own construction arguments) before invoking selection.
  4. Migrate to RolePlayOrchestrator with an explicit orchestrator agent instead of the obsolete API.

Example fix

// before
var chat = new GroupChat(admin: null, members: members);
var next = await chat.SelectNextSpeakerAsync(speaker, history); // throws when >1 candidate

// after
var admin = new GPTAgent("admin", "You pick the next speaker.", llmConfig);
var chat = new GroupChat(admin: admin, members: members);
var next = await chat.SelectNextSpeakerAsync(speaker, history);
Defensive patterns

Strategy: validation

Validate before calling

if (admin is null && workflowIsAbsentOrAmbiguous)
    throw new ConfigurationException("GroupChat needs an admin agent for speaker selection");
var chat = new GroupChat(admin, members);

Try / catch

try { return await chat.SelectNextSpeakerAsync(speaker, history); }
catch (ArgumentException ex) when (ex.Message.Contains("No admin"))
{
    // construct the chat with an admin agent, then retry
}

Prevention

When it happens

Trigger: Constructing GroupChat(admin: null, members) and then calling SelectNextSpeakerAsync when no workflow narrows candidates to exactly one; a workflow yielding 2+ candidates with no admin to arbitrate.

Common situations: Using GroupChat purely as a message hub without planning for speaker selection; passing null admin because the constructor allows it; upgrading code that previously always used a workflow with single-candidate transitions.

Related errors


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