{"record":{"id":"8bb736357a2919a1","repo":"elsa-workflows/elsa-core","slug":"a-workflow-resumer-is-required-to-complete-a-user-task","errorCode":null,"errorMessage":"A workflow resumer is required to complete a User Task.","messagePattern":"A workflow resumer is required to complete a User Task\\.","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.UserTasks/Services/DefaultUserTaskWorkflowResumer.cs","lineNumber":14,"sourceCode":"using Elsa.UserTasks.Contracts;\nusing Elsa.UserTasks.Models;\nusing Elsa.Workflows.Runtime;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Elsa.UserTasks.Services;\n\npublic sealed class DefaultUserTaskWorkflowResumer(IServiceProvider services) : IUserTaskWorkflowResumer\n{\n    public async Task ResumeAsync(UserTask task, UserTaskStimulus stimulus, CancellationToken cancellationToken = default)\n    {\n        var resumer = services.GetService<IWorkflowResumer>();\n        if (resumer == null)\n            throw new InvalidOperationException(\"A workflow resumer is required to complete a User Task.\");\n\n        await resumer.ResumeAsync(task.BookmarkId, new Dictionary<string, object>\n        {\n            [Elsa.UserTasks.Activities.UserTask.InputKey] = stimulus\n        }, cancellationToken);\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.UserTasks/Services/DefaultUserTaskWorkflowResumer.cs#L1-L22","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nservices.AddUserTasks(); // resumer not registered\n// after\nservices.AddElsa(elsa => elsa.UseWorkflowRuntime()); // registers IWorkflowResumer alongside User Tasks","handlingStrategy":"type-guard","validationCode":"if (services.GetService<Elsa.Workflows.Runtime.IWorkflowResumer>() is null)\n    throw new InvalidOperationException(\"IWorkflowResumer is not registered; add the workflow runtime module.\");","typeGuard":"var canResume = serviceProvider.GetService<Elsa.Workflows.Runtime.IWorkflowResumer>() is not null;","tryCatchPattern":"try { await resumer.ResumeAsync(task, stimulus, ct); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"workflow resumer is required\")) { /* fix host DI registration */ }","preventionTips":["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"],"tags":["dependency-injection","user-task","missing-service"],"backgroundTag":"missing-dependency","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}