microsoft/semantic-kernel · error · ArgumentException
A complete listen_for condition is required for orchestratio
Error message
A complete listen_for condition is required for orchestration steps.
What it means
Thrown by BuildOrchestrationAsync when an OrchestrationStep has a null ListenFor. Orchestration steps are listen/then rules; a missing listen_for makes the rule unprocessable, so the builder rejects it before attempting to wire edges.
Source
Thrown at dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs:236
#endregion
#region Orchestration
private Task BuildOrchestrationAsync(List<OrchestrationStep> orchestrationSteps, ProcessBuilder processBuilder)
{
// 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,View on GitHub (pinned to c028a0c7dc)
Solutions
- Add a complete 'listen_for' object to each orchestration step before 'then'.
- Validate step.ListenFor != null for every orchestration step before building.
- Remove orchestration entries that have no trigger condition if they are vestigial.
Example fix
// before
step.ListenFor = null; step.Then = new List<ThenAction> { ... };
// after
step.ListenFor = new ListenCondition { /* AllOf/AnyOf etc. */ }; Defensive patterns
Strategy: validation
Validate before calling
foreach (var s in orchestrationSteps)
if (s.ListenFor is null) throw new ArgumentException($"Orchestration step missing listen_for."); Type guard
static bool ListenForPresent(OrchestrationStep s) => s.ListenFor is not null;
Try / catch
try { await builder.BuildProcessAsync(workflow, yaml); }
catch (ArgumentException ex) when (ex.Message.Contains("listen_for condition is required"))
{ /* add the listen_for block */ } Prevention
- Author orchestration rules with both listen_for and then in templates.
- Run a structural validator over orchestration steps before building.
- Reject orchestration entries missing a trigger condition at load time.
When it happens
Trigger: A workflow orchestration entry whose 'listen_for' is null/omitted while 'then' is present, or both missing with listen_for checked first.
Common situations: Workflow YAML with an orchestration block that lists 'then' actions but no 'listen_for'; deserialization leaving ListenFor null; partial rule definitions.
Related errors
- At least one then action is required for orchestration steps
- 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/be5064b433e36c99.
Report an issue: GitHub.