OrchardCMS/OrchardCore · error · NotSupportedException
The syntax isn't supported for IfElseTask.
Error message
The syntax {Syntax} isn't supported for IfElseTask. What it means
IfElseTask evaluates its condition by switching on the activity's Syntax. Only Liquid (LiquidCondition) and JavaScript (Condition) evaluation are implemented; any other WorkflowScriptSyntax value hits the default arm and throws NotSupportedException, so the workflow branch cannot be decided.
Solutions
- Set Syntax to WorkflowScriptSyntax.Liquid and put the boolean condition in the LiquidCondition field.
- Or set Syntax to WorkflowScriptSyntax.JavaScript and provide the boolean condition in the Condition field.
- Repair the stored workflow definition if it contains a legacy/invalid syntax value.
- If a new syntax member exists in the enum, rebuild/update OrchardCore.Workflows so the switch arm is implemented.
Example fix
// before
var ifElse = new IfElseTask(); // Syntax unset -> unsupported
// after
var ifElse = new IfElseTask
{
Syntax = WorkflowScriptSyntax.JavaScript,
Condition = new JavaScriptExpression { Expression = "inputs.get('count') > 0" }
}; Defensive patterns
Strategy: validation
Validate before calling
// before running the workflow
if (ifElseTask.Syntax is not (WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript))
throw new InvalidOperationException($"IfElseTask requires Liquid or JavaScript syntax; got {ifElseTask.Syntax}"); Type guard
static bool IsSupportedSyntax(WorkflowScriptSyntax s) => s is WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript;
Try / catch
try { result = await activity.ExecuteAsync(workflowContext, activityContext); }
catch (NotSupportedException ex) { logger.LogError(ex, "IfElseTask condition evaluation failed for syntax {Syntax}", syntax); /* route to error outcome */ } Prevention
- Set Syntax explicitly on IfElseTask
- Keep Condition/LiquidCondition consistent with the selected syntax
- Validate imported workflow definitions
- Update activity switches whenever WorkflowScriptSyntax gains members
When it happens
Trigger: Executing an IfElseTask whose Syntax property is not WorkflowScriptSyntax.Liquid or WorkflowScriptSyntax.JavaScript — typically an unset/default enum value, an unrecognized syntax string deserialized from workflow JSON, or programmatic creation without assigning Syntax.
Common situations: Hand-edited or imported workflow definitions with stale syntax names after a version change; a newly added WorkflowScriptSyntax member that IfElseTask does not handle; missing Syntax assignment when instantiating the activity in code.
Related errors
- The syntax isn't supported for ForEachTask.
- The syntax isn't supported for ForLoopTask.
- The syntax isn't supported for SetOutputTask.
- The syntax isn't supported for SetPropertyTask.
- The syntax isn't supported for WhileLoopTask.
AI-assisted analysis of OrchardCMS/OrchardCore@4306c0717f (2026-09-13).
Data as JSON: /api/errors/61ee721d4215a46b.
Report an issue: GitHub.
Appendix: source
Thrown at src/OrchardCore.Modules/OrchardCore.Workflows/Activities/IfElseTask.cs:58
set => SetProperty(value);
}
public WorkflowScriptSyntax Syntax
{
get => GetProperty(() => WorkflowScriptSyntax.JavaScript);
set => SetProperty(value);
}
public override IEnumerable<Outcome> GetPossibleOutcomes(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
=> Outcome(S["True"], S["False"]);
public override async Task<ActivityExecutionResult> ExecuteAsync(WorkflowExecutionContext workflowContext, ActivityContext activityContext)
{
var result = Syntax switch
{
WorkflowScriptSyntax.Liquid => await _expressionEvaluator.EvaluateAsync(LiquidCondition, workflowContext, null),
WorkflowScriptSyntax.JavaScript => await _scriptEvaluator.EvaluateAsync(Condition, workflowContext),
_ => throw new NotSupportedException($"The syntax {Syntax} isn't supported for IfElseTask.")
};
return Outcome(result ? "True" : "False");
}
}
View on GitHub (pinned to 4306c0717f)