{"record":{"id":"f285f751237bd649","repo":"dotnet/orleans","slug":"named-option-azureblobleaseprovideroptions-of-name","errorCode":null,"errorMessage":"Named option AzureBlobLeaseProviderOptions of name {name} is invalid.  Name cannot be empty or whitespace.","messagePattern":"Named option AzureBlobLeaseProviderOptions of name (.+?) is invalid\\.  Name cannot be empty or whitespace\\.","errorType":"exception","errorClass":"OrleansConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Streaming.AzureStorage/Options/AzureBlobLeaseProviderOptions.cs","lineNumber":150,"sourceCode":"        }\n\n        /// <summary>\n        /// Constructor\n        /// </summary>\n        /// <param name=\"options\">The option to be validated.</param>\n        /// <param name=\"name\">The option name to be validated.</param>\n        private AzureBlobLeaseProviderOptionsValidator(AzureBlobLeaseProviderOptions options, string? name)\n        {\n            this.options = options;\n            this.name = name ?? string.Empty;\n        }\n\n        public void ValidateConfiguration()\n        {\n            // name can be null, but not empty or white space.\n            if(this.name != null && string.IsNullOrWhiteSpace(this.name))\n            {\n                throw new OrleansConfigurationException($\"Named option {nameof(AzureBlobLeaseProviderOptions)} of name {this.name} is invalid.  Name cannot be empty or whitespace.\");\n            }\n\n            if (this.options.CreateClient is null)\n            {\n                throw new OrleansConfigurationException($\"No credentials specified for Azure Blob Service lease provider \\\"{name}\\\". Use the {options.GetType().Name}.{nameof(AzureBlobLeaseProviderOptions.ConfigureBlobServiceClient)} method to configure the Azure Blob Service client.\");\n            }\n\n            try\n            {\n                AzureBlobUtils.ValidateContainerName(this.options.BlobContainerName);\n            }\n            catch (ArgumentException e)\n            {\n                var errorStr = string.IsNullOrEmpty(this.name)\n                    ? $\"Configuration for {nameof(AzureBlobLeaseProviderOptions)} {this.name} is invalid. {nameof(this.options.BlobContainerName)} is not valid\"\n                    : $\"Configuration for {nameof(AzureBlobLeaseProviderOptions)} is invalid. {nameof(this.options.BlobContainerName)} is not valid\";\n                throw new OrleansConfigurationException(errorStr , e);\n            }","sourceCodeStart":132,"sourceCodeEnd":168,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Streaming.AzureStorage/Options/AzureBlobLeaseProviderOptions.cs#L132-L168","documentation":"Thrown by AzureBlobLeaseProviderOptionsValidator.ValidateConfiguration() when the options name is non-null but empty or whitespace. The validator allows null names (converted to string.Empty in the constructor) but considers empty/whitespace non-null names invalid. Note: the constructor sets this.name = name ?? string.Empty, so a null name becomes empty string and this check WILL fire on it — meaning effectively any empty or whitespace name triggers the error.","triggerScenarios":"Fires during ValidateConfiguration() when this.name is a non-null, empty-or-whitespace string. Since the constructor converts null to string.Empty, any null or empty name passed to the validator will trigger this. This typically means the lease provider options were registered with an empty name.","commonSituations":"A streaming provider or lease provider registered without a name (or with an explicit empty string). Orleans default options name is often empty string \"\" — if the validator is wired for that default name, this fires. Mismatch between the name used to register the provider and the expected name.","solutions":["Register the AzureBlobLeaseProvider with a non-empty, non-whitespace name.","If using Orleans streaming, ensure the stream provider name is non-empty and flows through to the lease provider options.","Check the AddAzureBlobLeaseProvider or equivalent registration call — pass an explicit non-empty name string.","Avoid passing string.Empty or null as the options name."],"exampleFix":"// before: empty name\nsiloBuilder.AddAzureBlobLeaseProvider(\"\", o => { ... });\n\n// after: non-empty name\nsiloBuilder.AddAzureBlobLeaseProvider(\"blobLeases\", o => { ... });","handlingStrategy":"validation","validationCode":"// Verify the lease provider name is non-empty before registration\nvar leaseProviderName = \"blobLeases\";\nif (string.IsNullOrWhiteSpace(leaseProviderName))\n    throw new InvalidOperationException(\"Lease provider name must be non-empty and non-whitespace.\");\nsiloBuilder.AddAzureBlobLeaseProvider(leaseProviderName, o => { ... });","typeGuard":null,"tryCatchPattern":"try { await host.StartAsync(ct); }\ncatch (OrleansConfigurationException ex) when (ex.Message.Contains(\"Name cannot be empty or whitespace\"))\n{\n    logger.LogCritical(ex, \"Lease provider name is empty — provide a non-empty name.\");\n    throw;\n}","preventionTips":["Always pass a non-empty, non-whitespace name to AddAzureBlobLeaseProvider.","Avoid using string.Empty or null as a provider name.","Use a naming convention for streaming providers that guarantees non-empty names.","Be aware the constructor converts null to empty string, so null names WILL trigger this error."],"tags":["azure","blob-storage","lease-provider","configuration","validation","naming","streaming","orleans"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}