{"record":{"id":"5f15cfd63fe79a0f","repo":"elsa-workflows/elsa-core","slug":"elsa-platform-maximum-artifact-size-must-be-between-1-byte","errorCode":null,"errorMessage":"Elsa Platform maximum artifact size must be between 1 byte and the maximum runtime buffer size.","messagePattern":"Elsa Platform maximum artifact size must be between 1 byte and the maximum runtime buffer size\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs","lineNumber":49,"sourceCode":"        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":31,"sourceCodeEnd":54,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs#L31-L54","documentation":"MaxArtifactBytes caps the size of command artifacts this runtime will download from the Platform. Validate() requires a value between 1 and Array.MaxLength, protecting the runtime buffer from oversized payloads.","triggerScenarios":"Enabled = true plus Validate() with MaxArtifactBytes <= 0 or > Array.MaxLength.","commonSituations":"Config value bound to 0 or negative from a bad appsettings entry; someone set int.MaxValue * 2 or long.MaxValue; forgetting to set the value when all other options are configured manually.","solutions":["Set MaxArtifactBytes to a sane positive limit, e.g. 10 * 1024 * 1024 (10 MB).","Fix the bound configuration value so it parses to a positive integer.","Cap the configured value: Math.Min(configured, Array.MaxLength)."],"exampleFix":"// before\noptions.MaxArtifactBytes = 0;\n// after\noptions.MaxArtifactBytes = 10 * 1024 * 1024;","handlingStrategy":"validation","validationCode":"if (options.Enabled && (options.MaxArtifactBytes <= 0 || options.MaxArtifactBytes > Array.MaxLength))\n    options.MaxArtifactBytes = 10 * 1024 * 1024;","typeGuard":null,"tryCatchPattern":"try { options.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"maximum artifact size\"))\n{\n    logger.LogError(ex, \"MaxArtifactBytes must be between 1 and Array.MaxLength.\");\n}","preventionTips":["Use a conservative default (e.g. 10 MB) and document the unit (bytes).","Validate bound config values parse to positive integers.","Cap user-configured values with Math.Min against Array.MaxLength."],"tags":["configuration","validation","limit","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"}