elsa-workflows/elsa-core · error · NotSupportedException
Interval expression type
Error message
Interval expression type '{intervalExpression.Type}' is not supported. What it means
RecurringTaskScheduleManager.CreateSchedule maps an IntervalExpression to a CronSchedule or IntervalSchedule via a switch expression. An IntervalExpressionType outside the two known members falls to the discard arm and throws this NotSupportedException.
Solutions
- Only construct IntervalExpression with IntervalExpressionType.Cron or IntervalExpressionType.Interval.
- Upgrade/patch so the schedule manager handles the newer interval expression type.
- Validate the expression type before calling GetScheduleFor and reject unknown values early.
- If you added an enum member, extend the switch in CreateSchedule with the matching schedule implementation.
Example fix
// before
new IntervalExpression { Type = (IntervalExpressionType)99, Expression = "..." }
// after
new IntervalExpression { Type = IntervalExpressionType.Interval, Expression = "00:05:00" } Defensive patterns
Strategy: validation
Validate before calling
if (expr.Type is not (IntervalExpressionType.Cron or IntervalExpressionType.Interval))
throw new ArgumentException($"Interval type {expr.Type} is not supported by this scheduler."); Type guard
bool IsSupportedInterval(IntervalExpression e) => e.Type is IntervalExpressionType.Cron or IntervalExpressionType.Interval;
Try / catch
try { schedule = manager.GetScheduleFor(intervalExpression); }
catch (NotSupportedException ex) { logger.LogError(ex, "Unsupported interval type {Type}", intervalExpression.Type); } Prevention
- Validate expression types when parsing user-provided recurrence config
- Re-check supported types after Elsa upgrades that extend IntervalExpressionType
- Constrain persistence inputs to the supported enum values
When it happens
Trigger: Passing an IntervalExpression whose Type is neither Cron nor Interval — typically a new enum member added to IntervalExpressionType that this manager does not yet handle, or an uninitialized/default value.
Common situations: Upgrading Elsa adds a new interval type (e.g. custom schedule) while custom RecurringTask code or persisted expressions use it before the manager supports it; default(enum) leaking in.
Related errors
- Unsupported console stream value
- The console log stream filter has an unsupported numeric…
- Expression type is not supported
- Expression type is not supported as Expression
- The upstream logout mode must be a string.
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/687ff9f07702f60b.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Common/RecurringTasks/RecurringTaskScheduleManager.cs:28
public ISchedule GetScheduleFor(Type taskType)
{
if (!ScheduledTasks.TryGetValue(taskType, out var schedule))
{
var intervalExpression = options.Value.Schedule.ScheduledTasks.TryGetValue(taskType, out var expr) ? expr : null;
schedule = intervalExpression != null ? CreateSchedule(intervalExpression) : new IntervalSchedule(TimeSpan.FromMinutes(1));
ScheduledTasks[taskType] = schedule;
}
return schedule;
}
private ISchedule CreateSchedule(IntervalExpression intervalExpression)
{
return intervalExpression.Type switch
{
IntervalExpressionType.Cron => new CronSchedule(systemClock, CronExpression.Parse(intervalExpression.Expression)),
IntervalExpressionType.Interval => new IntervalSchedule(TimeSpan.Parse(intervalExpression.Expression)),
_ => throw new NotSupportedException($"Interval expression type '{intervalExpression.Type}' is not supported.")
};
}
}View on GitHub (pinned to fe9217bdfa)