elsa-workflows/elsa-core · error · NotSupportedException
Expression type is not supported
Error message
Expression type {exprNode.GetType().Name} is not supported What it means
In ElsaScriptCompiler.CompileExpressionAsInput, when an expression node is compiled as an Input<T> value and the node is neither a literal, variable, nor (via EvaluateConstantExpression) a supported array literal, the compiler throws NotSupportedException naming the node type. The DSL only knows how to statically evaluate a fixed set of expression node shapes; anything else cannot be turned into a constructor argument value.
Solutions
- Wrap the dynamic expression in an explicit Elsa expression, e.g. `${...}` or `(js) ...`, so it becomes an Expression instead of a constant-evaluated value
- Simplify the argument to a literal or variable reference the compiler can evaluate
- Check the supported node types in EvaluateConstantExpression and restructure the script accordingly
- If this is a valid construct, extend CompileExpressionAsInput/EvaluateConstantExpression to handle the node type
Example fix
// before
WriteLine(message: user.Name.ToUpper())
// after
WriteLine(message: `${user.Name.toUpperCase()}`) Defensive patterns
Strategy: try-catch
Try / catch
try { activity = CompileActivityInvocation(node); }
catch (NotSupportedException ex) when (ex.Message.Contains("is not supported"))
{
// fall back to explicit ${} expression syntax for this argument
throw new ElsaScriptAuthoringException(ex.Message + " — use `${...}` for dynamic arguments", ex);
} Prevention
- Use literals or `${...}` expressions for any computed activity argument
- Avoid inline arithmetic/function-call expressions in positional arguments
- Check ElsaScript release notes for newly supported expression shapes
When it happens
Trigger: Passing a complex expression (e.g. a function call, binary operation, or interpolated expression) as a positional/named constructor argument to an activity invocation, where the compiler tries to evaluate it as a constant Input<T> value.
Common situations: Authoring ElsaScript and using arithmetic or function-call expressions in activity arguments; upgrading the DSL and using node types newly produced by the parser but not yet handled by the compiler.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Expression type is not supported as Expression
- Entry point label ' ' not found in flowchart
- No matching constructor found for activity type
- Multiple matching constructors found for activity type
- Unexpected non-optional, non-Input
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/97db89cddf963c4d.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs:462
// If not found, treat as a literal
return new(new Literal<T>(default!));
}
if (exprNode is ElsaExpressionNode elsaExpr)
{
var language = elsaExpr.Language != null ? MapLanguageName(elsaExpr.Language) : _defaultExpressionLanguage;
var expression = new Expression(language, elsaExpr.Expression);
return new(expression);
}
if (exprNode is ArrayLiteralNode arrayLiteral)
{
// For array literals, evaluate to a constant array if all elements are literals
var elements = arrayLiteral.Elements.Select(EvaluateConstantExpression).ToArray();
return new((T)(object)elements);
}
throw new NotSupportedException($"Expression type {exprNode.GetType().Name} is not supported");
}
private Expression CompileExpressionAsExpression(ExpressionNode exprNode)
{
if (exprNode is LiteralNode literal)
{
return Expression.LiteralExpression(literal.Value);
}
if (exprNode is ElsaExpressionNode elsaExpr)
{
var language = elsaExpr.Language != null ? MapLanguageName(elsaExpr.Language) : _defaultExpressionLanguage;
return new(language, elsaExpr.Expression);
}
throw new NotSupportedException($"Expression type {exprNode.GetType().Name} is not supported as Expression");
}
View on GitHub (pinned to fe9217bdfa)