elsa-workflows/elsa-core · critical · ActivityNotFoundException

Activity type not found

Error message

Activity type not found

What it means

NotFoundActivity.Execute throws ActivityNotFoundException carrying the missing activity type name and version. NotFoundActivity is a placeholder substituted when a workflow definition references an activity type not registered in the activity registry, so the failure surfaces at execution time instead of silently skipping the node.

Solutions

  1. Register the missing activity type: load the assembly and install the activity feature/module via the Elsa options.
  2. Read MissingTypeName/MissingTypeVersion on the NotFoundActivity or exception to identify the absent type.
  3. Fix typos in the definition's activity Type field or re-save the definition in the designer.
  4. If the activity was intentionally removed, remove or replace the node in the workflow definition.

Example fix

// before
// workflow references type "MyCustomActivity" but it is not registered; execution throws
// after
services.AddElsa(elsa => elsa.AddActivitiesFrom<MyCustomActivity>()); // register the type so the activity resolves
Defensive patterns

Strategy: validation

Validate before calling

// before executing, verify all activity types in the definition are registered
var registry = serviceProvider.GetRequiredService<IActivityRegistry>();
foreach (var activity in workflowDefinition.Activities)
{
    if (!registry.IsActivityTypeRegistered(activity.Type))
        throw new InvalidOperationException($"Activity type '{activity.Type}' is not registered.");
}

Type guard

static bool IsRegistered(IActivityRegistry registry, string type) => registry.IsActivityTypeRegistered(type);

Try / catch

try { await workflowRunner.RunAsync(workflow); }
catch (ActivityNotFoundException ex)
{
    logger.LogError(ex, "Missing activity type '{Type}' (version {Version})", ex.MissingType, ex.MissingTypeVersion);
}

Prevention

When it happens

Trigger: Executing a workflow instance whose definition contains an activity whose Type (and version, when specified) has no registration in the running application's activity registry.

Common situations: Deploying a workflow to an app lacking the package/custom activity used by the definition; renaming or deleting a custom activity class while old definitions still reference the old type; typos in the Type string; version mismatches.

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


AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13). Data as JSON: /api/errors/dcd26f4a3983ec11. Report an issue: GitHub.

Appendix: source

Thrown at src/modules/Elsa.Workflows.Core/Activities/NotFoundActivity.cs:46

    /// <summary>
    /// The type name of the missing activity type.
    /// </summary>
    public string MissingTypeName { get; set; } = null!;
    
    /// <summary>
    /// The version of the missing activity type.
    /// </summary>
    public int MissingTypeVersion { get; set; }

    /// <summary>
    /// The original activity JSON.
    /// </summary>
    public string OriginalActivityJson { get; set; } = null!;

    /// <inheritdoc />
    protected override void Execute(ActivityExecutionContext context)
    {
        throw new ActivityNotFoundException(MissingTypeName, MissingTypeVersion);
    }
}

View on GitHub (pinned to fe9217bdfa)