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

  1. Set PollInterval to a positive TimeSpan, e.g. TimeSpan.FromSeconds(5).
  2. Check the bound configuration value (Elsa:PlatformIntegration:PollInterval) for typos or zero values.
  3. 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

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


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)