elsa-workflows/elsa-core · error · InvalidOperationException
Elsa Platform poll interval must be positive.
Error message
Elsa Platform poll interval must be positive.
What it means
PollInterval controls how often the runtime polls the Elsa Platform for pending commands. Validate() rejects any interval that is TimeSpan.Zero or negative, because a non-positive interval would cause a busy loop or an invalid timer period.
Solutions
- Set PollInterval to a positive TimeSpan, e.g. TimeSpan.FromSeconds(5).
- Check the bound configuration value (Elsa:PlatformIntegration:PollInterval) for typos or zero values.
- If relying on defaults, confirm the feature's default options supply a valid interval.
Example fix
// before options.PollInterval = TimeSpan.Zero; // after options.PollInterval = TimeSpan.FromSeconds(5);
Defensive patterns
Strategy: validation
Validate before calling
if (options.Enabled && options.PollInterval <= TimeSpan.Zero)
options.PollInterval = TimeSpan.FromSeconds(5); Try / catch
try { options.Validate(); }
catch (InvalidOperationException ex) when (ex.Message.Contains("poll interval"))
{
logger.LogError(ex, "PollInterval must be positive; check the bound config value.");
} Prevention
- Parse intervals from config with TimeSpan.Parse and assert positivity before binding.
- Never set PollInterval to TimeSpan.Zero expecting immediate polling.
- Add unit tests covering default option construction.
When it happens
Trigger: Enabled = true plus Validate() with PollInterval set to TimeSpan.Zero, a negative TimeSpan, or left as default zero.
Common situations: Binding PollInterval from a malformed config string that parses to zero; explicitly setting TimeSpan.Zero expecting 'poll immediately'; copying sample config that omitted the interval while another rule earlier in validation masked it.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Elsa Platform claim lease duration must be between 1 second…
- Elsa Platform maximum artifact size must be between 1 byte…
- A configuration key is required.
- Adapter settings migrations must define an adapter type and…
- Configuration connection
AI-assisted analysis of elsa-workflows/elsa-core@fe9217bdfa (2026-09-13).
Data as JSON: /api/errors/7a5cd2fe8510c100.
Report an issue: GitHub.
Appendix: source
Thrown at src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs:45
public IReadOnlyList<string> Capabilities { get; set; } = ["loom.recipe.apply"];
public void Validate()
{
if (!Enabled)
return;
if (PlatformEndpoint is null)
throw new InvalidOperationException("Elsa Platform endpoint is required when Platform integration is enabled.");
if (WorkspaceId == Guid.Empty)
throw new InvalidOperationException("Elsa Platform workspace ID is required when Platform integration is enabled.");
if (EngineId == Guid.Empty)
throw new InvalidOperationException("Elsa Platform engine ID is required when Platform integration is enabled.");
if (string.IsNullOrWhiteSpace(EngineSecret))
throw new InvalidOperationException("Elsa Platform engine secret is required when Platform integration is enabled.");
if (string.IsNullOrWhiteSpace(WorkerId))
throw new InvalidOperationException("Elsa Platform worker ID is required when Platform integration is enabled.");
if (PollInterval <= TimeSpan.Zero)
throw new InvalidOperationException("Elsa Platform poll interval must be positive.");
if (ClaimLeaseDuration < TimeSpan.FromSeconds(1) || ClaimLeaseDuration.TotalSeconds > int.MaxValue)
throw new InvalidOperationException("Elsa Platform claim lease duration must be between 1 second and the maximum supported Platform lease.");
if (MaxArtifactBytes <= 0 || MaxArtifactBytes > Array.MaxLength)
throw new InvalidOperationException("Elsa Platform maximum artifact size must be between 1 byte and the maximum runtime buffer size.");
if (string.IsNullOrWhiteSpace(ShellOverlayPath))
throw new InvalidOperationException("Elsa Platform shell overlay path is required when Platform integration is enabled.");
}
}
View on GitHub (pinned to fe9217bdfa)