{"record":{"id":"1598654b8012e4cb","repo":"microsoft/autogen","slug":"no-admin-is-provided","errorCode":null,"errorMessage":"No admin is provided.","messagePattern":"No admin is provided\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.Core/GroupChat/GroupChat.cs","lineNumber":131,"sourceCode":"        var agentNames = this.agents.Select(x => x.Name).ToList();\n        if (this.workflow != null)\n        {\n            var nextAvailableAgents = await this.workflow.TransitToNextAvailableAgentsAsync(currentSpeaker, conversationHistory);\n            agentNames = nextAvailableAgents.Select(x => x.Name).ToList();\n            if (agentNames.Count == 0)\n            {\n                throw new ArgumentException(\"No next available agents found in the current workflow\");\n            }\n\n            if (agentNames.Count == 1)\n            {\n                return this.agents.First(x => x.Name == agentNames.First());\n            }\n        }\n\n        if (this.admin == null)\n        {\n            throw new ArgumentException(\"No admin is provided.\");\n        }\n\n        var systemMessage = new TextMessage(Role.System,\n            content: $@\"You are in a role play game. Carefully read the conversation history and carry on the conversation.\nThe available roles are:\n{string.Join(\",\", agentNames)}\n\nEach message will start with 'From name:', e.g:\nFrom {agentNames.First()}:\n//your message//.\");\n\n        var conv = this.ProcessConversationsForRolePlay(this.initializeMessages, conversationHistory);\n\n        var messages = new IMessage[] { systemMessage }.Concat(conv);\n        var response = await this.admin.GenerateReplyAsync(\n            messages: messages,\n            options: new GenerateReplyOptions\n            {","sourceCodeStart":113,"sourceCodeEnd":149,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.Core/GroupChat/GroupChat.cs#L113-L149","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Provide an admin agent (e.g. a GPTAgent with a strong model) when constructing the GroupChat.","If you never want LLM-based selection, ensure the workflow always reduces candidates to exactly one.","Check `chat.admin == null`-equivalent state (or your own construction arguments) before invoking selection.","Migrate to RolePlayOrchestrator with an explicit orchestrator agent instead of the obsolete API."],"exampleFix":"// before\nvar chat = new GroupChat(admin: null, members: members);\nvar next = await chat.SelectNextSpeakerAsync(speaker, history); // throws when >1 candidate\n\n// after\nvar admin = new GPTAgent(\"admin\", \"You pick the next speaker.\", llmConfig);\nvar chat = new GroupChat(admin: admin, members: members);\nvar next = await chat.SelectNextSpeakerAsync(speaker, history);","handlingStrategy":"validation","validationCode":"if (admin is null && workflowIsAbsentOrAmbiguous)\n    throw new ConfigurationException(\"GroupChat needs an admin agent for speaker selection\");\nvar chat = new GroupChat(admin, members);","typeGuard":null,"tryCatchPattern":"try { return await chat.SelectNextSpeakerAsync(speaker, history); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"No admin\"))\n{\n    // construct the chat with an admin agent, then retry\n}","preventionTips":["Always pass an admin agent when constructing GroupChat unless every workflow transition yields exactly one candidate.","Keep one well-prompted 'admin' GPTAgent per chat configuration.","Treat a null admin as a configuration smell and validate it in your chat factory."],"tags":["autogen","dotnet","group-chat","admin-agent","speaker-selection","argumentexception"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}