{"record":{"id":"d2b7d32c5e11eab1","repo":"elsa-workflows/elsa-core","slug":"no-published-version-of-workflow-definition-with-id-d2b7d3","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":null,"httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Workflows.Runtime/Activities/ExecuteWorkflow.cs","lineNumber":87,"sourceCode":"\n        // Since the child workflow is still running, we need to wait for it to complete using a bookmark.\n        var bookmarkOptions = new CreateBookmarkArgs\n        {\n            Callback = OnChildWorkflowCompletedAsync,\n            Stimulus = new ExecuteWorkflowStimulus(result.WorkflowInstanceId),\n            IncludeActivityInstanceId = false\n        };\n        context.CreateBookmark(bookmarkOptions);\n    }\n\n    private async ValueTask<ExecuteWorkflowResult> ExecuteWorkflowAsync(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 parentInstanceId = context.WorkflowExecutionContext.Id;\n        var input = Input.GetOrDefault(context) ?? new Dictionary<string, object>();\n        var correlationId = CorrelationId.GetOrDefault(context);\n        var workflowInvoker = context.GetRequiredService<IWorkflowInvoker>();\n        var identityGenerator = context.GetRequiredService<IIdentityGenerator>();\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 ResumeExecuteWorkflowActivity to resume the parent workflow.\n        if (waitForCompletion)\n            properties[\"WaitForCompletion\"] = true;\n\n        input[\"ParentInstanceId\"] = parentInstanceId;\n\n        var options = new RunWorkflowOptions","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Workflows.Runtime/Activities/ExecuteWorkflow.cs#L69-L105","documentation":"Thrown by the ExecuteWorkflow activity (ExecuteWorkflowAsync) when IWorkflowDefinitionService.FindWorkflowGraphAsync returns null for the given WorkflowDefinitionId with VersionOptions.Published. ExecuteWorkflow runs a child workflow synchronously in-process, so it requires a published version to build the workflow graph; without one the execution cannot proceed.","triggerScenarios":"Executing an ExecuteWorkflow activity whose WorkflowDefinitionId input resolves to a definition that has no published version at that moment: target is still a draft, the only published version was retracted/superseded, the ID is wrong or belongs to a deleted/foreign-environment definition.","commonSituations":"Chaining workflows during development before publishing the child; renaming/recreating a workflow and referencing the old ID; a CI/CD deploy that ships the parent workflow but not the published child; multi-tenant setups where the definition exists in another tenant.","solutions":["Publish the target workflow definition so a published version exists (Studio publish or IWorkflowDefinitionPublisher.PublishAsync).","Confirm the WorkflowDefinitionId input equals the ID of the published definition in the current environment/tenant.","If the workflow was retracted or superseded, publish a new version of it before executing the parent.","Programmatically verify availability before execution with workflowDefinitionService.FindWorkflowGraphAsync(id, VersionOptions.Published) and fail fast with a clear message."],"exampleFix":"// before\nvar child = new ExecuteWorkflow { WorkflowDefinitionId = new(\"order-processing-draft-id\") };\n\n// after: guard and publish first\nvar graph = await workflowDefinitionService.FindWorkflowGraphAsync(id, VersionOptions.Published, ct);\nif (graph == null) await workflowDefinitionPublisher.PublishAsync(draft);\nvar child = new ExecuteWorkflow { WorkflowDefinitionId = new(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; cannot execute child workflow.\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Publish child workflows before wiring parent ExecuteWorkflow activities to them.","Keep child workflow deployment and publication in sync with parent workflows across environments.","Resolve definitions by name with a published-version lookup at design time instead of hardcoding possibly stale IDs.","Avoid retracting published versions while parent workflows referencing them may still execute."],"tags":["workflow","dotnet","execute-workflow","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-16T04:17:20.429Z"}