{"record":{"id":"b67aa86475965e0b","repo":"elsa-workflows/elsa-core","slug":"no-published-version-of-workflow-definition-with-id-b67aa8","errorCode":null,"errorMessage":"No published version of workflow definition with ID {workflowDefinitionId} found.","messagePattern":"No published version of workflow definition with ID (.+?) found\\.","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Workflows.Runtime/Activities/DispatchWorkflow.cs","lineNumber":108,"sourceCode":"                IncludeActivityInstanceId = false\n            };\n            context.CreateBookmark(bookmarkOptions);\n        }\n        else\n        {\n            // Otherwise, we can complete immediately.\n            await context.CompleteActivityAsync();\n        }\n    }\n\n    private async ValueTask<string> DispatchChildWorkflowAsync(ActivityExecutionContext context, bool waitForCompletion)\n    {\n        var workflowDefinitionId = WorkflowDefinitionId.Get(context);\n        var workflowDefinitionService = context.GetRequiredService<IWorkflowDefinitionService>();\n        var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionId, VersionOptions.Published, context.CancellationToken);\n\n        if (workflowGraph == null)\n            throw new($\"No published version of workflow definition with ID {workflowDefinitionId} found.\");\n\n        var input = Input.GetOrDefault(context) ?? new Dictionary<string, object>();\n        var channelName = ChannelName.GetOrDefault(context);\n        var startNewTrace = StartNewTrace.GetOrDefault(context);\n        var parentInstanceId = context.WorkflowExecutionContext.Id;\n        var properties = new Dictionary<string, object>\n        {\n            [\"ParentInstanceId\"] = parentInstanceId,\n        };\n\n        // If we need to wait for the child workflow to complete, set the property. This will be used by the ResumeDispatchWorkflowActivity handler.\n        if (waitForCompletion) properties[\"WaitForCompletion\"] = true;\n        if (startNewTrace) properties[\"StartNewTrace\"] = true;\n        \n        input[\"ParentInstanceId\"] = parentInstanceId;\n\n        var correlationId = CorrelationId.GetOrDefault(context);\n        var workflowDispatcher = context.GetRequiredService<IWorkflowDispatcher>();","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Workflows.Runtime/Activities/DispatchWorkflow.cs#L90-L126","documentation":"Thrown by the DispatchWorkflow activity (DispatchChildWorkflowAsync) when IWorkflowDefinitionService.FindWorkflowGraphAsync returns null for the requested workflow definition ID with VersionOptions.Published. It means no currently published version of the referenced definition exists, so the child workflow cannot be dispatched. Elsa resolves only published versions by default; drafts or superseded versions do not qualify.","triggerScenarios":"Executing a DispatchWorkflow activity whose WorkflowDefinitionId input points to a definition ID that has no published version at execution time (e.g. only a draft exists, the published version was retracted, or the ID is mistyped/points to a deleted definition).","commonSituations":"Referencing a workflow by ID copied from a draft or from JSON before publication; retracting or deleting the target workflow while a parent that dispatches it is still running; building the workflow programmatically and forgetting to publish via IWorkflowDefinitionPublisher; environment drift where the target workflow exists in one environment but was never published in another.","solutions":["Publish the target workflow definition (Studio publish action or IWorkflowDefinitionPublisher.PublishAsync) so a version with VersionOptions.Published exists.","Verify the WorkflowDefinitionId input value matches an existing definition ID (check the workflow registry / definition store; watch for typos or IDs from another environment).","If dispatching by definition name/version is intended, resolve the correct published definition ID first via IWorkflowDefinitionManager or the definitions API.","Check version history: if the published version was superseded or retracted, publish a new version before running the parent workflow."],"exampleFix":"// before: ID from a draft workflow, never published\nvar dispatch = new DispatchWorkflow { WorkflowDefinitionId = new(\"my-draft-workflow-id\") };\n\n// after: publish first, then reference the published definition\nawait workflowDefinitionPublisher.PublishAsync(draftDefinition);\nvar dispatch = new DispatchWorkflow { WorkflowDefinitionId = new(publishedDefinition.Id) };","handlingStrategy":"validation","validationCode":"var graph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionId, VersionOptions.Published, ct);\nif (graph is null)\n    throw new InvalidOperationException($\"Workflow definition '{workflowDefinitionId}' has no published version. Publish it before dispatching.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always publish workflows (not just save as draft) before referencing them from DispatchWorkflow activities.","Copy definition IDs from the published workflow in the target environment, not from local drafts.","Include the target workflow in the same deployment/CI step as the parent workflow.","Add a startup or pre-deploy check that all dispatched workflow IDs resolve to published versions."],"tags":["workflow","dotnet","dispatch","versioning","elsa"],"backgroundTag":"resource-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"}