elsa-workflows/elsa-core · error · InvalidOperationException
Property ' ' not found on activity type
Error message
Property '{arg.Name}' not found on activity type '{activityType.Name}' What it means
While compiling an activity invocation, named arguments are mapped onto CLR properties of the activity type via reflection; if a named argument has no matching property on the activity type, the compiler throws InvalidOperationException naming the argument and activity type. The script passed a property the activity does not declare.
Solutions
- Fix the argument name to match the activity's property (Elsa inputs are C# properties, matching by exact name).
- Check the activity's input definitions/descriptor for the correct property names.
- Upgrade the activity package if the script targets an older property name; or update the script after a rename.
- Catch InvalidOperationException during compilation and highlight the offending argument in the editor.
Example fix
// before httpGet(url: "https://example.com") // property is 'Url' // after httpGet(Url: "https://example.com")
Defensive patterns
Strategy: validation
Validate before calling
const descriptor = await registry.find(d => d.name === invocation.name); const bad = invocation.args.filter(a => a.name && !descriptor.inputs?.some(p => p.name === a.name)); if (bad.length) throw new Error('Unknown properties: ' + bad.map(b => b.name).join(', ')); Type guard
function argsMatchDescriptor(args, descriptor) { return args.every(a => !a.name || descriptor.inputs.some(p => p.name === a.name)); } Try / catch
try { await compileScript(script); } catch (InvalidOperationException ex) when (ex.Message.Contains("not found on activity type")) { highlightBadArgument(ex); } Prevention
- Generate argument autocompletion from the activity descriptor's input list.
- Re-validate scripts after upgrading activity packages (property renames).
- Match argument names exactly to the activity's C# input properties.
When it happens
Trigger: Invoking an activity with a named argument (arg.Name) that does not correspond to any public settable property on the resolved activityDescriptor.ClrType.
Common situations: Typo in a named argument (e.g. 'url' vs 'Url'), argument names from an older activity version that was renamed, or passing non-input fields that are not exposed as properties.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Value cannot be null. (Parameter 'type')
- Multiple Invoke methods were found. Use either Invoke or…
- No Invoke methods were found. Use either Invoke or…
- The method must return Task or ValueTask
- Type not found.
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/64098444faea1dc3.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Dsl.ElsaScript/Compiler/ElsaScriptCompiler.cs:223
// No positional arguments, use default constructor
var activityConstructorContext = new ActivityConstructorContext(activityDescriptor, (t) => new(ActivityActivator.Create(t)));
var activityConstructionResult = activityDescriptor.Constructor(activityConstructorContext);
activity = activityConstructionResult.Activity;
}
// Set named argument properties
foreach (var arg in namedArgs)
{
var property = activityType.GetProperty(arg.Name!);
if (property != null)
{
var value = CompileExpression(arg.Value, property.PropertyType);
property.SetValue(activity, value);
}
else
{
throw new InvalidOperationException($"Property '{arg.Name}' not found on activity type '{activityType.Name}'");
}
}
return activity;
}
private async Task<IActivity> CompileBlockAsync(BlockNode block, CancellationToken cancellationToken = default)
{
var activities = new List<IActivity>();
foreach (var statement in block.Statements)
{
var activity = await CompileStatementAsync(statement, cancellationToken);
if (activity != null)
{
activities.Add(activity);
}
}View on GitHub (pinned to fe9217bdfa)