elsa-workflows/elsa-core · error · InputEvaluationException

Failed to evaluate activity input

Error message

Failed to evaluate activity input '{inputDescriptor.Name}'

What it means

An InputEvaluationException wrapping any exception raised while evaluating an activity input property. It preserves the failing input name and inner exception, turning low-level evaluation failures (expression errors, missing variables, conversion failures) into a typed, contextual error.

Solutions

  1. Inspect the InnerException to find the root cause (expression error, missing variable, etc.).
  2. Fix the referenced variable/workflow input names in the expression.
  3. Provide default values or make the input optional where null is acceptable.
  4. Test the expression standalone (e.g., run the same JS expression in isolation) to catch syntax errors.

Example fix

// before
// Workflow input 'Amount' not provided; expression: Amount * 2 -> wrapped InputEvaluationException

// after
// Start workflow with input: new { Amount = 10 }
// or use a safe expression: (Amount ?? 0) * 2
Defensive patterns

Strategy: try-catch

Validate before calling

// pre-check variables referenced by the expression exist in workflow memory/context

Try / catch

try
{
    var value = await context.EvaluateInputPropertyAsync("Amount");
}
catch (Elsa.Workflows.Core.Exceptions.InputEvaluationException ex)
{
    logger.LogError(ex.InnerException, "Input '{Input}' failed to evaluate", ex.InputName);
}

Prevention

When it happens

Trigger: Any exception thrown inside EvaluateInputPropertyCoreAsync - e.g., a JavaScript/C#/Liquid expression failing, referenced variable not found in memory, expression syntax error, or underlying activity input getter throwing - during EvaluateInputPropertyAsync.

Common situations: Expression references a variable that was deleted or renamed; workflow input not supplied at start so expression evaluates against null; syntax errors in JavaScript expressions; custom expression evaluators throwing.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13). Data as JSON: /api/errors/eb4dfe8a21ddb22a. Report an issue: GitHub.

Appendix: source

Thrown at src/modules/Elsa.Workflows.Core/Extensions/ActivityExecutionContextExtensions.InputEvaluation.cs:81

        /// <returns>The evaluated value.</returns>
        public async Task<T?> EvaluateAsync<T>(Input<T> input)
        {
            var evaluator = context.GetRequiredService<IExpressionEvaluator>();
            var memoryBlockReference = input.MemoryBlockReference();
            var value = await evaluator.EvaluateAsync(input, context.ExpressionExecutionContext);
            memoryBlockReference.Set(context, value);
            return value;
        }

        private async Task<object?> EvaluateInputPropertyAsync(ActivityDescriptor activityDescriptor, InputDescriptor inputDescriptor)
        {
            try
            {
                return await EvaluateInputPropertyCoreAsync(context, activityDescriptor, inputDescriptor);
            }
            catch (Exception e)
            {
                throw new InputEvaluationException(inputDescriptor.Name, $"Failed to evaluate activity input '{inputDescriptor.Name}'", e);
            }
        }

        private async Task<object?> EvaluateInputPropertyCoreAsync(ActivityDescriptor activityDescriptor, InputDescriptor inputDescriptor)
        {
            var activity = context.Activity;
            var defaultValue = inputDescriptor.DefaultValue;
            var value = defaultValue;
            var input = inputDescriptor.ValueGetter(activity);
            var identityGenerator = context.GetRequiredService<IIdentityGenerator>();

            if (inputDescriptor.IsWrapped)
            {
                var wrappedInput = (Input?)input;

                if (defaultValue != null && wrappedInput == null)
                {
                    var typedInput = typeof(Input<>).MakeGenericType(inputDescriptor.Type);

View on GitHub (pinned to fe9217bdfa)