{"record":{"id":"76a45511f3e5f027","repo":"microsoft/autogen","slug":"there-are-more-than-one-available-agents-from-the","errorCode":null,"errorMessage":"There are more than one available agents from the workflow for the next speaker.","messagePattern":"There are more than one available agents from the workflow for the next speaker\\.","errorType":"exception","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/AutoGen.Core/Orchestrator/WorkflowOrchestrator.cs","lineNumber":51,"sourceCode":"        if (currentSpeaker == null)\n        {\n            return null;\n        }\n        var nextAgents = await this.workflow.TransitToNextAvailableAgentsAsync(currentSpeaker, context.ChatHistory, cancellationToken);\n        nextAgents = nextAgents.Where(nextAgent => candidates.Any(candidate => candidate.Name == nextAgent.Name));\n        candidates = nextAgents.ToList();\n        if (!candidates.Any())\n        {\n            return null;\n        }\n\n        if (candidates is { Count: 1 })\n        {\n            return candidates.First();\n        }\n        else\n        {\n            throw new ArgumentException(\"There are more than one available agents from the workflow for the next speaker.\");\n        }\n    }\n}\n","sourceCodeStart":33,"sourceCodeEnd":55,"githubUrl":"https://github.com/microsoft/autogen/blob/027ecf0a379bcc1d09956d46d12d44a3ad9cee14/dotnet/src/AutoGen.Core/Orchestrator/WorkflowOrchestrator.cs#L33-L55","documentation":"Thrown by WorkflowOrchestrator.GetNextSpeakerAsync when the workflow graph yields MORE than one next agent for the current speaker. Unlike RolePlayOrchestrator (which falls back to an admin LLM to disambiguate), WorkflowOrchestrator requires the graph to produce exactly one next speaker and throws ArgumentException otherwise.","triggerScenarios":"Building a Graph where a node has multiple outgoing transitions that are all valid given the current chat history, then running GroupChat with WorkflowOrchestrator; TransitToNextAvailableAgentsAsync returns 2+ agents and the Count==1 check fails.","commonSituations":"Designing a fan-out workflow (one reviewer broadcasting to two writers), adding transitions whose conditions are all satisfied in the same round, or converting a RolePlayOrchestrator setup (which tolerated ambiguity) to WorkflowOrchestrator.","solutions":["Redesign the graph so each node has exactly one satisfied outgoing transition per round (add conditions to transitions)","If multiple next speakers are legitimate, use RolePlayOrchestrator with the workflow, which uses an admin agent to pick one","Add a disambiguating intermediary node that routes to exactly one successor","Catch ArgumentException to detect graph design errors early in tests"],"exampleFix":"// before: workflow.AddTransition(a, b); workflow.AddTransition(a, c); // ambiguous when both conditions pass\n// after: make conditions mutually exclusive\nworkflow.AddTransition(a, b, ct => ct.ChatHistory.Last().GetContent()?.Contains(\"B\") == true);\nworkflow.AddTransition(a, c, ct => ct.ChatHistory.Last().GetContent()?.Contains(\"C\") == true);","handlingStrategy":"validation","validationCode":"// Validate the graph has deterministic out-degree before starting the chat\nforeach (var node in workflow.Transitions.GroupBy(t => t.From))\n{\n    // at runtime conditions matter; at minimum assert no unconditional fan-out\n    if (node.Count(t => t.Condition is null) > 1)\n        throw new InvalidOperationException($\"Node {node.Key} has ambiguous unconditional transitions\");\n}","typeGuard":null,"tryCatchPattern":"try { await groupChat.CallAsync(input, maxRound, ct); }\ncatch (ArgumentException e) when (e.Message.Contains(\"more than one available agents\"))\n{ /* redesign graph conditions or switch to RolePlayOrchestrator(workflow) */ }","preventionTips":["Give every transition a mutually exclusive condition in fan-out graphs","Use RolePlayOrchestrator when the next speaker is genuinely ambiguous"],"tags":["autogen","workflow","orchestrator","graph-design"],"backgroundTag":null,"analyzedSha":"027ecf0a379bcc1d09956d46d12d44a3ad9cee14","analyzedAt":"2026-08-15T03:38:00.719Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}