elsa-workflows / elsa-workflows/elsa-core

System.InvalidOperationException: Workflow graph with handle DefinitionVersionId: not found.

Open
#6,362 14 comments 1 reaction 1 assignee Claimed by @sfmskywalker View on GitHub
triaged
Dominant language
C#
Stars
7.9k
Forks
1.5k
Avg merge
15h 22m
Merged PRs (30d)
114

Description

## Description
Workflow with delay does not finish because of the error. The project is using Hangfire for scheduling and sqlite database for persistence. In the database the value of DefinitionVersionId in the corresponding row of WorkflowInstance table is empty string.

## Steps to Reproduce
To help us identify the issue more quickly, please follow these guidelines:

1. **Detailed Steps**: The workflow is defined in code and added to Elsa runtime in setup.
```
public class SampleWorkflow : WorkflowBase
{
protected override void Build(IWorkflowBuilder builder)
{
builder.WithDefinitionId("X");
builder.Description = "ABC";

builder.Root = new Sequence
{
Version = 1,
RunAsynchronously = true,
Activities =
[
new WriteLine("Start workflow"),
new Delay(TimeSpan.FromSeconds(3)),
new WriteLine("Resumed after delay!"),
],
};
}
}

```

2. **Attachments**: The minimal project is attached - [workflows.zip](https://github.com/user-attachments/files/18632007/workflows.zip).

3. **Reproduction Rate**: every time.

4. **Additional Configuration**: no additional configuration

## Expected Behavior
I expect the workflow to finish without any issues.

## Actual Behavior
The workflow does not continue when resumed after delay.

## Environment
- **Elsa Package Version**: 3.3.1
- **Operating System**: Pop!_OS 22.04 LTS, also tried on Windows 10 with the same result, also tried without Hangfire with the same result.

## Log Output
```
Failed to process the job 'f79257cf-f329-4587-a5ab-68738ba9cb09': an exception occurred. Retry attempt 1 of 10 will be performed in 00:00:40.
System.InvalidOperationException: Workflow graph with handle DefinitionVersionId: not found.
at Elsa.Workflows.Runtime.LocalWorkflowClient.GetWorkflowGraphAsync(WorkflowDefinitionHandle definitionHandle, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.LocalWorkflowClient.GetWorkflowGraphAsync(WorkflowInstance workflowInstance, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.LocalWorkflowClient.RunInstanceAsync(WorkflowInstance workflowInstance, RunWorkflowInstanceRequest request, CancellationToken cancellationToken)
at Elsa.Workflows.Runtime.LocalWorkflowClient.RunInstanceAsync(RunWorkflowInstanceRequest request, CancellationToken cancellationToken)
at Elsa.Hangfire.Jobs.ResumeWorkflowJob.ExecuteAsync(String name, ScheduleExistingWorkflowInstanceRequest request, CancellationToken cancellationToken)
at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.