{"record":{"id":"b90549923e450a0a","repo":"elsa-workflows/elsa-core","slug":"elsa-platform-worker-id-is-required-when-platform","errorCode":null,"errorMessage":"Elsa Platform worker ID is required when Platform integration is enabled.","messagePattern":"Elsa Platform worker ID is required when Platform integration is enabled\\.","errorType":"validation","errorClass":"InvalidOperationException","httpStatus":null,"severity":"error","filePath":"src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs","lineNumber":43,"sourceCode":"    public string ShellOverlayPath { get; set; } = \"platform-shell-overrides.json\";\n\n    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":25,"sourceCodeEnd":54,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs#L25-L54","documentation":"The Platform integration requires a WorkerId that identifies this runtime worker instance to the Elsa Platform. Validate() throws when WorkerId is null, empty, or whitespace while integration is enabled. The worker ID is sent as a header on command polls and artifact downloads.","triggerScenarios":"Enabled = true plus Validate() with WorkerId not set (null/empty/whitespace).","commonSituations":"Forgot to assign a worker identifier when wiring options in code; configuration section missing the WorkerId key; running multiple workers and assuming an ID would be auto-generated (it is not).","solutions":["Set WorkerId to a stable unique value, e.g. Environment.MachineName or a GUID persisted per instance.","Bind WorkerId from configuration/environment (e.g. Elsa:PlatformIntegration:WorkerId).","Disable Platform integration if the runtime should not register as a worker."],"exampleFix":"// before\noptions.Enabled = true;\n// after\noptions.Enabled = true;\noptions.WorkerId = $\"worker-{Environment.MachineName}-{Environment.ProcessId}\";","handlingStrategy":"validation","validationCode":"if (options.Enabled && string.IsNullOrWhiteSpace(options.WorkerId))\n    options.WorkerId = $\"worker-{Environment.MachineName}-{Guid.NewGuid():N}\";","typeGuard":null,"tryCatchPattern":"try { options.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"worker ID\"))\n{\n    logger.LogError(ex, \"WorkerId must be set for Platform integration.\");\n}","preventionTips":["Generate a stable per-instance worker ID at first startup and persist it.","Validate options with ValidateOnStart so missing IDs fail deployment, not runtime.","Ensure each scaled-out instance gets a distinct WorkerId."],"tags":["configuration","startup-validation","platform-integration"],"backgroundTag":"missing-required-config-field","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"}