{"record":{"id":"e09f0896a9dabe44","repo":"elsa-workflows/elsa-core","slug":"elsa-platform-claim-lease-duration-must-be-between-1-second","errorCode":null,"errorMessage":"Elsa Platform claim lease duration must be between 1 second and the maximum supported Platform lease.","messagePattern":"Elsa Platform claim lease duration must be between 1 second and the maximum supported Platform lease\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs","lineNumber":47,"sourceCode":"    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":29,"sourceCodeEnd":54,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs#L29-L54","documentation":"ClaimLeaseDuration is the lease duration requested when this worker claims a Platform command. Validate() requires it to be at least 1 second and at most int.MaxValue seconds, matching the maximum lease the Platform supports.","triggerScenarios":"Enabled = true plus Validate() with ClaimLeaseDuration < TimeSpan.FromSeconds(1) or ClaimLeaseDuration.TotalSeconds > int.MaxValue.","commonSituations":"Setting a sub-second lease (e.g. TimeSpan.FromMilliseconds(500)) for fast tests; setting TimeSpan.MaxValue or an unbounded duration; unit tests constructing options with default(TimeSpan).","solutions":["Set ClaimLeaseDuration to a value between 1 second and int.MaxValue seconds, e.g. TimeSpan.FromMinutes(5).","Clamp the value in code: Math.Max(TimeSpan.FromSeconds(1), configuredLease).","Check that configuration parsing did not produce a sub-second value from a string like '0.5'."],"exampleFix":"// before\noptions.ClaimLeaseDuration = TimeSpan.FromMilliseconds(500);\n// after\noptions.ClaimLeaseDuration = TimeSpan.FromMinutes(5);","handlingStrategy":"validation","validationCode":"var min = TimeSpan.FromSeconds(1);\nvar max = TimeSpan.FromSeconds(int.MaxValue);\nif (options.Enabled && (options.ClaimLeaseDuration < min || options.ClaimLeaseDuration > max))\n    options.ClaimLeaseDuration = TimeSpan.FromMinutes(5);","typeGuard":null,"tryCatchPattern":"try { options.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"claim lease\"))\n{\n    logger.LogError(ex, \"ClaimLeaseDuration out of range [1s, int.MaxValue s].\");\n}","preventionTips":["Clamp configured lease durations to the supported range before validation.","Avoid TimeSpan.MaxValue-style sentinel values; use finite durations.","Match lease duration to expected command processing time plus margin."],"tags":["configuration","validation","lease","platform-integration"],"backgroundTag":"value-out-of-range","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"}