OrchardCMS/OrchardCore · error · NotSupportedException

The syntax isn't supported for SetOutputTask.

Error message

The syntax {Syntax} isn't supported for SetOutputTask.

What it means

SetOutputTask computes the value to write into workflowContext.Output by switching on the activity's Syntax. Only Liquid (LiquidValue) and JavaScript (Value) evaluation are implemented; any other WorkflowScriptSyntax value reaches the default arm and throws NotSupportedException, so the output is never set.

Solutions

  1. Set Syntax to WorkflowScriptSyntax.Liquid and supply the value expression in the LiquidValue field.
  2. Or set Syntax to WorkflowScriptSyntax.JavaScript and provide the value expression in the Value field.
  3. Fix the stored workflow definition if it holds an invalid/legacy syntax value.
  4. If a new syntax member was added to the enum, rebuild/update OrchardCore.Workflows so ExecuteAsync handles it.

Example fix

// before
var task = new SetOutputTask(); // Syntax unset -> throws
// after
var task = new SetOutputTask
{
    Syntax = WorkflowScriptSyntax.Liquid,
    OutputName = "Result",
    LiquidValue = new LiquidString { Expression = "{{ Model.Value }}" }
};
Defensive patterns

Strategy: validation

Validate before calling

// before executing the task
if (setOutputTask.Syntax is not (WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript))
    throw new InvalidOperationException($"SetOutputTask requires Liquid or JavaScript syntax; got {setOutputTask.Syntax}");

Type guard

static bool IsSupportedSyntax(WorkflowScriptSyntax s) => s is WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript;

Try / catch

try { result = await task.ExecuteAsync(workflowContext, activityContext); }
catch (NotSupportedException ex) { logger.LogError(ex, "SetOutputTask evaluation failed for syntax {Syntax}", syntax); /* mark output unset */ }

Prevention

When it happens

Trigger: Executing a SetOutputTask whose Syntax property is not WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript (default/unset enum value, unknown syntax deserialized from workflow JSON, or programmatic construction without Syntax).

Common situations: Imported workflow definitions from older environments with obsolete syntax values; a new WorkflowScriptSyntax enum member not yet supported by SetOutputTask; forgetting to assign Syntax when building the activity in code (commonly surfaced in unit tests that construct the task directly).

Related errors


AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13). Data as JSON: /api/errors/61e40d7078119b7a. Report an issue: GitHub.

Appendix: source

Thrown at src/OrchardCore.Modules/OrchardCore.Workflows/Activities/SetOutputTask.cs:61

        set => SetProperty(value);
    }

    public WorkflowScriptSyntax Syntax
    {
        get => GetProperty(() => WorkflowScriptSyntax.JavaScript);
        set => SetProperty(value);
    }

    public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
        => Outcome(S["Done"]);

    public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
    {
        var value = Syntax switch
        {
            WorkflowScriptSyntax.Liquid => await _expressionEvaluator.EvaluateAsync(LiquidValue, workflowContext, null),
            WorkflowScriptSyntax.JavaScript => await _scriptEvaluator.EvaluateAsync(Value, workflowContext),
            _ => throw new NotSupportedException($"The syntax {Syntax} isn't supported for SetOutputTask.")
        };

        workflowContext.Output[OutputName] = value;

        return Outcome("Done");
    }
}

View on GitHub (pinned to 4306c0717f)