microsoft/semantic-kernel · error · ArgumentException
At least one then action is required for orchestration steps
Error message
At least one then action is required for orchestration steps.
What it means
Thrown by BuildOrchestrationAsync when an OrchestrationStep has a null or empty Then list. A listen_for condition without any 'then' actions has no effect, so the builder requires at least one action.
Source
Thrown at dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs:242
// If there are no orchestration steps, return
if (orchestrationSteps.Count == 0)
{
return Task.CompletedTask;
}
// Process the orchestration steps
foreach (var step in orchestrationSteps)
{
ListenCondition? listenCondition = step.ListenFor;
if (listenCondition is null)
{
throw new ArgumentException("A complete listen_for condition is required for orchestration steps.");
}
List<ThenAction>? thenActions = step.Then;
if (thenActions is null || thenActions.Count == 0)
{
throw new ArgumentException("At least one then action is required for orchestration steps.");
}
ProcessStepEdgeBuilder? edgeBuilder = null;
if (listenCondition.AllOf != null && listenCondition.AllOf.Count > 0)
{
MessageSourceBuilder GetSourceBuilder(ListenEvent listenEvent)
{
var sourceBuilder = this.FindSourceBuilder(new() { Event = listenEvent.Event, From = listenEvent.From }, processBuilder);
return new MessageSourceBuilder
(
messageType: listenEvent.Event,
source: this._stepBuilders[listenEvent.From],
null // TODO: Pass through condition.
);
}
// Handle AllOf conditionView on GitHub (pinned to c028a0c7dc)
Solutions
- Add at least one entry to the 'then' array for each orchestration step.
- Validate step.Then != null && step.Then.Count > 0 before building.
- Remove orchestration entries that intentionally have no consequent action.
Example fix
// before
step.Then = new List<ThenAction>();
// after
step.Then = new List<ThenAction> { new ThenAction { /* target */ } }; Defensive patterns
Strategy: validation
Validate before calling
foreach (var s in orchestrationSteps)
if (s.Then is null || s.Then.Count == 0) throw new ArgumentException($"Orchestration step {s} needs at least one then action."); Type guard
static bool HasThenActions(OrchestrationStep s) => s.Then is { Count: > 0 }; Try / catch
try { await builder.BuildProcessAsync(workflow, yaml); }
catch (ArgumentException ex) when (ex.Message.Contains("then action is required"))
{ /* add at least one then action */ } Prevention
- Require at least one then action per orchestration rule in templates.
- Validate Then non-empty alongside ListenFor in a pre-build validator.
- Remove orchestration entries that intentionally have no consequent.
When it happens
Trigger: An orchestration step whose 'then' array is null or contains zero entries (listen_for present but no consequent actions).
Common situations: Workflow YAML with a listen_for but an empty/missing then block; authoring a rule and forgetting to add actions; deserialization defaulting Then to an empty list.
Related errors
- A complete listen_for condition is required for orchestratio
- Workflow nodes are not specified.
- Workflow inputs are not specified.
- Unsupported node type: {node.Type}
- Declarative steps must have an agent defined.
AI-assisted analysis of microsoft/semantic-kernel@c028a0c7dc (2026-08-13).
Data as JSON: /api/errors/9590f30001d56705.
Report an issue: GitHub.