elsa-workflows/elsa-core · error · InvalidOperationException

Entry point label ' ' not found in flowchart

Error message

Entry point label '{flowchart.EntryPoint}' not found in flowchart

What it means

ElsaScript's flowchart compiler throws this when a workflow declares an `entryPoint` label that does not match any activity label defined in the flowchart. The compiler builds a label-to-activity map while compiling statements; if the declared entry point is absent, no start activity can be set, so compilation aborts. This is a fail-fast integrity check so workflows never run with an undefined start node.

Solutions

  1. Add or correct the label on the activity that should be the entry point so it matches flowchart.EntryPoint exactly
  2. Update the flowchart's entryPoint value to the exact name of an existing label (labels are case-sensitive)
  3. Remove the entryPoint declaration to fall back to the default start behavior
  4. Print/list all labels in the script and diff against the entryPoint value to spot the mismatch

Example fix

// before
flowchart entryPoint "ProccessOrder"
  ProccessOrder: HttpEndpoint(...)
// after (label matches)
flowchart entryPoint "ProcessOrder"
  ProcessOrder: HttpEndpoint(...)
Defensive patterns

Strategy: validation

Validate before calling

// before compiling
var labels = scriptLabels; // labels declared in the flowchart
if (!string.IsNullOrEmpty(entryPoint) && !labels.Contains(entryPoint))
    throw new ArgumentException($"EntryPoint '{entryPoint}' has no matching label. Labels: [{string.Join(", ", labels)}]");

Try / catch

try { await compiler.CompileAsync(script); }
catch (InvalidOperationException ex) when (ex.Message.Contains("Entry point label"))
{
    logger.LogError(ex, "ElsaScript entry point refers to a missing label");
}

Prevention

When it happens

Trigger: Compiling an ElsaScript source whose flowchart block declares `entryPoint "Foo"` (or similar) where no statement in the flowchart carries the label `Foo` — e.g. a typo, a renamed label, or a deleted activity that the entry point still references.

Common situations: Renaming or deleting a labelled activity without updating the flowchart's entryPoint; copy-pasting workflow scripts between files where labels differ; typos in label names or case 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/2fb727c1542ad4e8. Report an issue: GitHub.

Appendix: source

Thrown at src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs:406

                throw new InvalidOperationException($"Target label '{connNode.Target}' not found in flowchart");

            var source = new Endpoint(sourceActivity, connNode.Outcome);
            var target = new Endpoint(targetActivity);
            connections.Add(new Connection(source, target));
        }

        // Create flowchart activity
        var flowchartActivity = new Workflows.Activities.Flowchart.Activities.Flowchart
        {
            Activities = labelToActivity.Values.ToList(),
            Connections = connections
        };

        // Set entry point if specified
        if (!string.IsNullOrEmpty(flowchart.EntryPoint))
        {
            if (!labelToActivity.TryGetValue(flowchart.EntryPoint, out var startActivity))
                throw new InvalidOperationException($"Entry point label '{flowchart.EntryPoint}' not found in flowchart");

            flowchartActivity.Start = startActivity;
        }

        return flowchartActivity;
    }

    private async Task<IActivity> CompileListenAsync(ListenNode listen, CancellationToken cancellationToken = default)
    {
        // Listen is just a regular activity invocation that can start a workflow
        var activity = await CompileActivityInvocationAsync(listen.Activity, cancellationToken);

        // Try to set CanStartWorkflow if the activity supports it
        var canStartWorkflowProp = activity.GetType().GetProperty("CanStartWorkflow");
        if (canStartWorkflowProp != null && canStartWorkflowProp.PropertyType == typeof(bool))
        {
            canStartWorkflowProp.SetValue(activity, true);
        }

View on GitHub (pinned to fe9217bdfa)