{"record":{"id":"7a5cd2fe8510c100","repo":"elsa-workflows/elsa-core","slug":"elsa-platform-poll-interval-must-be-positive","errorCode":null,"errorMessage":"Elsa Platform poll interval must be positive.","messagePattern":"Elsa Platform poll interval must be positive\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs","lineNumber":45,"sourceCode":"    public IReadOnlyList<string> Capabilities { get; set; } = [\"loom.recipe.apply\"];\n\n    public void Validate()\n    {\n        if (!Enabled)\n            return;\n\n        if (PlatformEndpoint is null)\n            throw new InvalidOperationException(\"Elsa Platform endpoint is required when Platform integration is enabled.\");\n        if (WorkspaceId == Guid.Empty)\n            throw new InvalidOperationException(\"Elsa Platform workspace ID is required when Platform integration is enabled.\");\n        if (EngineId == Guid.Empty)\n            throw new InvalidOperationException(\"Elsa Platform engine ID is required when Platform integration is enabled.\");\n        if (string.IsNullOrWhiteSpace(EngineSecret))\n            throw new InvalidOperationException(\"Elsa Platform engine secret is required when Platform integration is enabled.\");\n        if (string.IsNullOrWhiteSpace(WorkerId))\n            throw new InvalidOperationException(\"Elsa Platform worker ID is required when Platform integration is enabled.\");\n        if (PollInterval <= TimeSpan.Zero)\n            throw new InvalidOperationException(\"Elsa Platform poll interval must be positive.\");\n        if (ClaimLeaseDuration < TimeSpan.FromSeconds(1) || ClaimLeaseDuration.TotalSeconds > int.MaxValue)\n            throw new InvalidOperationException(\"Elsa Platform claim lease duration must be between 1 second and the maximum supported Platform lease.\");\n        if (MaxArtifactBytes <= 0 || MaxArtifactBytes > Array.MaxLength)\n            throw new InvalidOperationException(\"Elsa Platform maximum artifact size must be between 1 byte and the maximum runtime buffer size.\");\n        if (string.IsNullOrWhiteSpace(ShellOverlayPath))\n            throw new InvalidOperationException(\"Elsa Platform shell overlay path is required when Platform integration is enabled.\");\n    }\n}\n","sourceCodeStart":27,"sourceCodeEnd":54,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs#L27-L54","documentation":"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.","triggerScenarios":"Enabled = true plus Validate() with PollInterval set to TimeSpan.Zero, a negative TimeSpan, or left as default zero.","commonSituations":"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.","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."],"exampleFix":"// before\noptions.PollInterval = TimeSpan.Zero;\n// after\noptions.PollInterval = TimeSpan.FromSeconds(5);","handlingStrategy":"validation","validationCode":"if (options.Enabled && options.PollInterval <= TimeSpan.Zero)\n    options.PollInterval = TimeSpan.FromSeconds(5);","typeGuard":null,"tryCatchPattern":"try { options.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"poll interval\"))\n{\n    logger.LogError(ex, \"PollInterval must be positive; check the bound config value.\");\n}","preventionTips":["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."],"tags":["configuration","validation","timing","platform-integration"],"backgroundTag":"invalid-config-value","analyzedSha":"fe9217bdfa0e27f0e09e45006eb6898f616e513d","analyzedAt":"2026-09-13T20:32:34.702Z","contentChangedAt":"2026-09-13T20:32:34.702Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}