{"record":{"id":"750c0ed2c9bacca4","repo":"elsa-workflows/elsa-core","slug":"elsa-platform-workspace-id-is-required-when-platform","errorCode":null,"errorMessage":"Elsa Platform workspace ID is required when Platform integration is enabled.","messagePattern":"Elsa Platform workspace 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":37,"sourceCode":"    public TimeSpan PollInterval { get; set; } = TimeSpan.FromSeconds(5);\n\n    public TimeSpan ClaimLeaseDuration { get; set; } = TimeSpan.FromMinutes(5);\n\n    public long MaxArtifactBytes { get; set; } = 4 * 1024 * 1024;\n\n    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":19,"sourceCodeEnd":54,"githubUrl":"https://github.com/elsa-workflows/elsa-core/blob/fe9217bdfa0e27f0e09e45006eb6898f616e513d/src/modules/Elsa.Platform.Integration/Options/ElsaPlatformIntegrationOptions.cs#L19-L54","documentation":"When the Platform integration is enabled, Validate requires a non-empty WorkspaceId (Guid != Guid.Empty). The workspace ID identifies which Platform workspace this engine belongs to; an empty Guid is treated as unconfigured and rejected.","triggerScenarios":"Calling Validate() with Enabled=true and WorkspaceId left at its default Guid.Empty — not bound from configuration or set programmatically.","commonSituations":"Missing Workspace:Id section in appsettings; default(Guid) placeholder not replaced; copying config from a template that omits the workspace ID.","solutions":["Set options.WorkspaceId to the Guid of your Elsa Platform workspace.","Ensure configuration binding supplies PlatformIntegration:WorkspaceId before validation runs.","Validate the Guid is non-empty at config load time with a clear startup failure message."],"exampleFix":"// before\nvar options = new ElsaPlatformIntegrationOptions { Enabled = true, PlatformEndpoint = endpoint, EngineId = guid, EngineSecret = \"s\", WorkerId = \"w\" };\noptions.Validate();\n// after\nvar options = new ElsaPlatformIntegrationOptions { Enabled = true, PlatformEndpoint = endpoint, WorkspaceId = Guid.Parse(\"...\"), EngineId = guid, EngineSecret = \"s\", WorkerId = \"w\" };\noptions.Validate();","handlingStrategy":"validation","validationCode":"if (options.Enabled && options.WorkspaceId == Guid.Empty)\n    throw new InvalidOperationException(\"WorkspaceId must be set when Platform integration is enabled.\");","typeGuard":"bool IsValid(ElsaPlatformIntegrationOptions o) => !o.Enabled || o.WorkspaceId != Guid.Empty;","tryCatchPattern":"try { options.Validate(); }\ncatch (InvalidOperationException ex) when (ex.Message.Contains(\"workspace ID is required\")) { /* log config gap and abort startup */ }","preventionTips":["Require the WorkspaceId key in configuration with validation on bind.","Never leave Guid fields at default in option objects.","Test option validation with a full-config fixture."],"tags":["configuration","options-validation","platform-integration","guid"],"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"}