{"record":{"id":"be5064b433e36c99","repo":"microsoft/semantic-kernel","slug":"a-complete-listen-for-condition-is-required-for-or","errorCode":null,"errorMessage":"A complete listen_for condition is required for orchestration steps.","messagePattern":"A complete listen_for condition is required for orchestration steps\\.","errorType":"validation","errorClass":"ArgumentException","httpStatus":null,"severity":"error","filePath":"dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs","lineNumber":236,"sourceCode":"    #endregion\n\n    #region Orchestration\n\n    private Task BuildOrchestrationAsync(List<OrchestrationStep> orchestrationSteps, ProcessBuilder processBuilder)\n    {\n        // If there are no orchestration steps, return\n        if (orchestrationSteps.Count == 0)\n        {\n            return Task.CompletedTask;\n        }\n\n        // Process the orchestration steps\n        foreach (var step in orchestrationSteps)\n        {\n            ListenCondition? listenCondition = step.ListenFor;\n            if (listenCondition is null)\n            {\n                throw new ArgumentException(\"A complete listen_for condition is required for orchestration steps.\");\n            }\n\n            List<ThenAction>? thenActions = step.Then;\n            if (thenActions is null || thenActions.Count == 0)\n            {\n                throw new ArgumentException(\"At least one then action is required for orchestration steps.\");\n            }\n\n            ProcessStepEdgeBuilder? edgeBuilder = null;\n\n            if (listenCondition.AllOf != null && listenCondition.AllOf.Count > 0)\n            {\n                MessageSourceBuilder GetSourceBuilder(ListenEvent listenEvent)\n                {\n                    var sourceBuilder = this.FindSourceBuilder(new() { Event = listenEvent.Event, From = listenEvent.From }, processBuilder);\n                    return new MessageSourceBuilder\n                    (\n                        messageType: listenEvent.Event,","sourceCodeStart":218,"sourceCodeEnd":254,"githubUrl":"https://github.com/microsoft/semantic-kernel/blob/c028a0c7dc4f0814cdcbaba9d998f187a41197bf/dotnet/src/Experimental/Process.Core/Workflow/WorkflowBuilder.cs#L218-L254","documentation":"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.","triggerScenarios":"A workflow orchestration entry whose 'listen_for' is null/omitted while 'then' is present, or both missing with listen_for checked first.","commonSituations":"Workflow YAML with an orchestration block that lists 'then' actions but no 'listen_for'; deserialization leaving ListenFor null; partial rule definitions.","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."],"exampleFix":"// before\nstep.ListenFor = null; step.Then = new List<ThenAction> { ... };\n\n// after\nstep.ListenFor = new ListenCondition { /* AllOf/AnyOf etc. */ };","handlingStrategy":"validation","validationCode":"foreach (var s in orchestrationSteps)\n    if (s.ListenFor is null) throw new ArgumentException($\"Orchestration step missing listen_for.\");","typeGuard":"static bool ListenForPresent(OrchestrationStep s) => s.ListenFor is not null;","tryCatchPattern":"try { await builder.BuildProcessAsync(workflow, yaml); }\ncatch (ArgumentException ex) when (ex.Message.Contains(\"listen_for condition is required\"))\n{ /* add the listen_for block */ }","preventionTips":["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."],"tags":["semantic-kernel","process","workflow","orchestration"],"backgroundTag":null,"analyzedSha":"c028a0c7dc4f0814cdcbaba9d998f187a41197bf","analyzedAt":"2026-08-13T13:48:05.040Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}