elsa-workflows/elsa-core · error · InvalidOperationException
A workflow resumer is required to complete a User Task.
Error message
A workflow resumer is required to complete a User Task.
What it means
DefaultUserTaskWorkflowResumer.ResumeAsync completes a User Task by resuming the suspended workflow through an IWorkflowResumer resolved from the service provider. If no IWorkflowResumer is registered in DI, the resumer cannot complete the task and throws InvalidOperationException. This is a missing-infrastructure error, not a task-state error.
Solutions
- Register the Elsa workflow runtime feature/module that provides IWorkflowResumer in the host's DI configuration.
- If building a minimal host, register an IWorkflowResumer implementation explicitly.
- Verify with services.GetService<IWorkflowResumer>() != null at startup and fail fast with a clear message.
Example fix
// before services.AddUserTasks(); // resumer not registered // after services.AddElsa(elsa => elsa.UseWorkflowRuntime()); // registers IWorkflowResumer alongside User Tasks
Defensive patterns
Strategy: type-guard
Validate before calling
if (services.GetService<Elsa.Workflows.Runtime.IWorkflowResumer>() is null)
throw new InvalidOperationException("IWorkflowResumer is not registered; add the workflow runtime module."); Type guard
var canResume = serviceProvider.GetService<Elsa.Workflows.Runtime.IWorkflowResumer>() is not null;
Try / catch
try { await resumer.ResumeAsync(task, stimulus, ct); }
catch (InvalidOperationException ex) when (ex.Message.Contains("workflow resumer is required")) { /* fix host DI registration */ } Prevention
- Add a startup smoke test that resolves all IUserTask* services
- Use the full Elsa host builder rather than assembling modules piecemeal
- Document required companion modules for User Tasks in your host setup guide
When it happens
Trigger: Calling IUserTaskWorkflowResumer.ResumeAsync (directly or via a 'complete task' endpoint/service) in an application whose DI container lacks an IWorkflowResumer registration — typically an Elsa host assembled without the workflow runtime resumer feature/module.
Common situations: Custom minimal Elsa hosts that registered the User Tasks module but not the workflow runtime pieces; trimming or feature-flagged setups that dropped the resumer registration; test hosts with a partial service collection.
Understand the failure class
Background: "not installed", "pip install", "required for": how missing-dependency errors surface across open-source libraries — this error's family across 34 libraries.
Related errors
- Build() must be called before accessing services
- External Authentication handle-hashing settings are…
- Invitation actions must be configured User Task actions.
- Invitation verifier names and allowed actions are required.
- Multiple handlers were found to handle the
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/8bb736357a2919a1.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.UserTasks/Services/DefaultUserTaskWorkflowResumer.cs:14
using Elsa.UserTasks.Contracts;
using Elsa.UserTasks.Models;
using Elsa.Workflows.Runtime;
using Microsoft.Extensions.DependencyInjection;
namespace Elsa.UserTasks.Services;
public sealed class DefaultUserTaskWorkflowResumer(IServiceProvider services) : IUserTaskWorkflowResumer
{
public async Task ResumeAsync(UserTask task, UserTaskStimulus stimulus, CancellationToken cancellationToken = default)
{
var resumer = services.GetService<IWorkflowResumer>();
if (resumer == null)
throw new InvalidOperationException("A workflow resumer is required to complete a User Task.");
await resumer.ResumeAsync(task.BookmarkId, new Dictionary<string, object>
{
[Elsa.UserTasks.Activities.UserTask.InputKey] = stimulus
}, cancellationToken);
}
}
View on GitHub (pinned to fe9217bdfa)