{"record":{"id":"f9f774e85c41a151","repo":"dotnet/orleans","slug":"configuration-for-azureblobleaseprovideroptions-n","errorCode":null,"errorMessage":"Configuration for AzureBlobLeaseProviderOptions {name} is invalid. BlobContainerName is not valid","messagePattern":"Configuration for AzureBlobLeaseProviderOptions (.+?) is invalid\\. BlobContainerName is not valid","errorType":"exception","errorClass":"OrleansConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Streaming.AzureStorage/Options/AzureBlobLeaseProviderOptions.cs","lineNumber":167,"sourceCode":"            {\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            }\n        }\n    }\n\n}\n","sourceCodeStart":149,"sourceCodeEnd":173,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Streaming.AzureStorage/Options/AzureBlobLeaseProviderOptions.cs#L149-L173","documentation":"Thrown by AzureBlobLeaseProviderOptionsValidator.ValidateConfiguration() when AzureBlobUtils.ValidateContainerName rejects BlobContainerName. NOTE: the ternary logic in the source is inverted — when string.IsNullOrEmpty(this.name) is TRUE (name is empty), it produces the message WITH the name interpolated (showing empty), which is the branch that fires for this error index. The container name must be 3-63 chars, lowercase alphanumeric with single hyphens.","triggerScenarios":"Fires during ValidateConfiguration() when this.options.BlobContainerName fails ValidateContainerName (empty, too short/long, uppercase, or invalid characters) AND this.name is empty. The catch wraps the ArgumentException into an OrleansConfigurationException.","commonSituations":"BlobContainerName left as default (null or empty), set to an uppercase or invalid value, or shorter than 3 characters. The lease provider was registered with an empty name. Note the message text is misleading because the ternary condition is inverted relative to its intent.","solutions":["Set BlobContainerName to a valid lowercase alphanumeric string (3-63 chars, optional single hyphens) in the options delegate.","Ensure the lease provider is registered with a proper non-empty name.","Verify the container name in appsettings.json matches Azure naming rules.","Be aware of the inverted ternary: the message with a name appears when name IS empty, not when it's set."],"exampleFix":"// before\nsiloBuilder.AddAzureBlobLeaseProvider(\"blobLeases\", o =>\n{\n    o.BlobContainerName = \"Lease_Container\"; // uppercase + underscore invalid\n});\n\n// after\nsiloBuilder.AddAzureBlobLeaseProvider(\"blobLeases\", o =>\n{\n    o.BlobContainerName = \"lease-container\";\n});","handlingStrategy":"validation","validationCode":"// Validate container name before registration\nvar containerName = \"lease-container\";\nif (!System.Text.RegularExpressions.Regex.IsMatch(containerName, @\"^[a-z0-9]+(-[a-z0-9]+)*$\")\n    || containerName.Length < 3 || containerName.Length > 63)\n    throw new InvalidOperationException($\"Invalid blob container name: '{containerName}'\");","typeGuard":null,"tryCatchPattern":"try { await host.StartAsync(ct); }\ncatch (OrleansConfigurationException ex) when (ex.Message.Contains(\"BlobContainerName is not valid\"))\n{\n    logger.LogError(ex, \"Blob lease provider container name is invalid — use 3-63 lowercase alphanumeric chars with hyphens.\");\n    throw;\n}","preventionTips":["Always set BlobContainerName to a valid lowercase alphanumeric string (3-63 chars).","Use a naming helper that validates against the Azure container name regex.","Be aware the source has an inverted ternary — the message format may be misleading.","Check appsettings.json for the BlobContainerName value in all environments."],"tags":["azure","blob-storage","lease-provider","configuration","validation","naming-rules","bug","streaming","orleans"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}