elsa-workflows/elsa-core · error
No published version of workflow definition with ID
Error message
No published version of workflow definition with ID {workflowDefinitionId} found. What it means
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.
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.
Example fix
// before
var child = new ExecuteWorkflow { WorkflowDefinitionId = new("order-processing-draft-id") };
// after: guard and publish first
var graph = await workflowDefinitionService.FindWorkflowGraphAsync(id, VersionOptions.Published, ct);
if (graph == null) await workflowDefinitionPublisher.PublishAsync(draft);
var child = new ExecuteWorkflow { WorkflowDefinitionId = new(id) }; Defensive patterns
Strategy: validation
Validate before calling
var graph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionId, VersionOptions.Published, ct);
if (graph is null)
throw new InvalidOperationException($"Workflow definition '{workflowDefinitionId}' has no published version; cannot execute child workflow."); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No published version of workflow definition with ID
- Workflow instance not found
- Workflow definition not found
- Cannot deserialize to .
- Failed to deserialize
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/d2b7d32c5e11eab1.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Workflows.Runtime/Activities/ExecuteWorkflow.cs:87
// Since the child workflow is still running, we need to wait for it to complete using a bookmark.
var bookmarkOptions = new CreateBookmarkArgs
{
Callback = OnChildWorkflowCompletedAsync,
Stimulus = new ExecuteWorkflowStimulus(result.WorkflowInstanceId),
IncludeActivityInstanceId = false
};
context.CreateBookmark(bookmarkOptions);
}
private async ValueTask<ExecuteWorkflowResult> ExecuteWorkflowAsync(ActivityExecutionContext context, bool waitForCompletion)
{
var workflowDefinitionId = WorkflowDefinitionId.Get(context);
var workflowDefinitionService = context.GetRequiredService<IWorkflowDefinitionService>();
var workflowGraph = await workflowDefinitionService.FindWorkflowGraphAsync(workflowDefinitionId, VersionOptions.Published, context.CancellationToken);
if (workflowGraph == null)
throw new($"No published version of workflow definition with ID {workflowDefinitionId} found.");
var parentInstanceId = context.WorkflowExecutionContext.Id;
var input = Input.GetOrDefault(context) ?? new Dictionary<string, object>();
var correlationId = CorrelationId.GetOrDefault(context);
var workflowInvoker = context.GetRequiredService<IWorkflowInvoker>();
var identityGenerator = context.GetRequiredService<IIdentityGenerator>();
var properties = new Dictionary<string, object>
{
["ParentInstanceId"] = parentInstanceId
};
// 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.
if (waitForCompletion)
properties["WaitForCompletion"] = true;
input["ParentInstanceId"] = parentInstanceId;
var options = new RunWorkflowOptionsView on GitHub (pinned to fe9217bdfa)