{"record":{"id":"97db89cddf963c4d","repo":"elsa-workflows/elsa-core","slug":"expression-type-exprnode-gettype-name-is-not-supported","errorCode":null,"errorMessage":"Expression type {exprNode.GetType().Name} is not supported","messagePattern":"Expression type (.+?) is not supported","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs","lineNumber":462,"sourceCode":"            // If not found, treat as a literal\n            return new(new Literal<T>(default!));\n        }\n\n        if (exprNode is ElsaExpressionNode elsaExpr)\n        {\n            var language = elsaExpr.Language != null ? MapLanguageName(elsaExpr.Language) : _defaultExpressionLanguage;\n            var expression = new Expression(language, elsaExpr.Expression);\n            return new(expression);\n        }\n\n        if (exprNode is ArrayLiteralNode arrayLiteral)\n        {\n            // For array literals, evaluate to a constant array if all elements are literals\n            var elements = arrayLiteral.Elements.Select(EvaluateConstantExpression).ToArray();\n            return new((T)(object)elements);\n        }\n\n        throw new NotSupportedException($\"Expression type {exprNode.GetType().Name} is not supported\");\n    }\n\n    private Expression CompileExpressionAsExpression(ExpressionNode exprNode)\n    {\n        if (exprNode is LiteralNode literal)\n        {\n            return Expression.LiteralExpression(literal.Value);\n        }\n\n        if (exprNode is ElsaExpressionNode elsaExpr)\n        {\n            var language = elsaExpr.Language != null ? MapLanguageName(elsaExpr.Language) : _defaultExpressionLanguage;\n            return new(language, elsaExpr.Expression);\n        }\n\n        throw new NotSupportedException($\"Expression type {exprNode.GetType().Name} is not supported as Expression\");\n    }\n","sourceCodeStart":444,"sourceCodeEnd":480,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs#L444-L480","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nWriteLine(message: user.Name.ToUpper())\n// after\nWriteLine(message: `${user.Name.toUpperCase()}`)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { activity = CompileActivityInvocation(node); }\ncatch (NotSupportedException ex) when (ex.Message.Contains(\"is not supported\"))\n{\n    // fall back to explicit ${} expression syntax for this argument\n    throw new ElsaScriptAuthoringException(ex.Message + \" — use `${...}` for dynamic arguments\", ex);\n}","preventionTips":["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"],"tags":["elsascript","compiler","expression","unsupported"],"backgroundTag":"unsupported-operation","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}