{"record":{"id":"38520b21b55cad5d","repo":"elsa-workflows/elsa-core","slug":"bpmn-element-start-elementid-binds-work-start-bindingref","errorCode":null,"errorMessage":"BPMN element '{start.ElementId}' binds work '{start.BindingRef}', which activity '{process.Id}' does not map to a child activity.","messagePattern":"BPMN element '(.+?)' binds work '(.+?)', which activity '(.+?)' does not map to a child activity\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Bpmn/Hosting/BpmnCommandApplier.cs","lineNumber":77,"sourceCode":"                    break;\n                case BpmnHostCommand.SignalEnclosingScope signal:\n                    await SignalEnclosingScopeAsync(signal);\n                    break;\n                default:\n                    // The command hierarchy is closed, so this can only be reached by a library version that added a\n                    // command this host has never heard of. Refusing is the only honest answer: silently skipping it\n                    // would run a different process than the one the interpreter decided on.\n                    throw new NotSupportedException($\"The BPMN host command '{command.GetType().Name}' is not supported by this host.\");\n            }\n\n            memory.SaveWork();\n        }\n    }\n\n    private async ValueTask StartWorkAsync(BpmnHostCommand.StartWork start)\n    {\n        var activity = process.FindWorkActivity(start.BindingRef)\n                       ?? throw new InvalidOperationException(\n                           $\"BPMN element '{start.ElementId}' binds work '{start.BindingRef}', which activity '{process.Id}' does not map to a child activity.\");\n\n        // The rule that a nested scope registers no start triggers is enforced by ApplyAsync's pre-scan, before any\n        // command in the batch is applied — not here, where earlier commands in the same batch could already have\n        // been applied and persisted.\n        var workflowExecutionContext = scopeContext.WorkflowExecutionContext;\n\n        // The child's context is created up front so that this scope has its id before the child ever runs, and can\n        // key the unit of work on it. The alternative — recognising the child by ActivityExecutionContext.Tag — is\n        // unsound across nested scopes, because the completion-callback dispatch rewrites the receiving context's Tag.\n        var childContext = await workflowExecutionContext.CreateActivityExecutionContextAsync(activity, new ActivityInvocationOptions\n        {\n            Owner = scopeContext,\n            Variables = BuildIterationVariables(start.IterationScope),\n            SchedulingActivityExecutionId = scopeContext.Id\n        });\n\n        // The correlation is opaque interpreter state that must travel with the work and, when the work is a nested","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Bpmn/Hosting/BpmnCommandApplier.cs#L59-L95","documentation":"BpmnCommandApplier.StartWorkAsync resolves a StartWork command's BindingRef to a child activity of the hosting process; if FindWorkActivity returns null the binding cannot be mapped and an InvalidOperationException is thrown naming the element, binding ref, and process id. This indicates the command batch references work that does not exist in the process activity tree.","triggerScenarios":"Applying a StartWork command whose BindingRef does not correspond to any child activity of the current process (process.FindWorkActivity returns null).","commonSituations":"Stale command batches produced against a different process revision; model edits that removed or renamed the bound activity; id mismatch between document and compiled activity tree.","solutions":["Rebuild/re-import the BPMN model so the command batch and activity tree refer to the same revision.","Verify the BindingRef in the error message exists as an element id in the BPMN document.","Ensure the process definition containing the bound element is the one actually deployed/executed."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"foreach (var c in commands.OfType<BpmnHostCommand.StartWork>())\n    if (process.FindWorkActivity(c.BindingRef) is null) throw new InvalidOperationException($\"BindingRef '{c.BindingRef}' missing from process '{process.Id}'.\");","typeGuard":null,"tryCatchPattern":"try { await applier.ApplyAsync(context, commands); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"does not map to a child activity\")) { log.LogError(ex, \"Stale BPMN binding\"); /* re-import model and retry */ }","preventionTips":["Rebuild command batches whenever the model revision changes.","Keep deployed definitions in sync with executed instances.","Validate BindingRefs against the imported document before execution."],"tags":["bpmn","binding","reference-error"],"backgroundTag":"record-not-found","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}