{"record":{"id":"30779a6a4f7fd0ec","repo":"dotnet/orleans","slug":"configuration-for-azureblobleaseprovideroptions-is","errorCode":null,"errorMessage":"Configuration for AzureBlobLeaseProviderOptions 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 FALSE (name has a value), it produces the message WITHOUT the name, 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 non-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 a non-empty name. Note the message omits the provider name due to the inverted ternary, making diagnosis slightly harder.","solutions":["Set BlobContainerName to a valid lowercase alphanumeric string (3-63 chars, optional single hyphens).","Check appsettings.json or the configure delegate for the container name value and fix formatting.","Test against the regex ^[a-z0-9]+(-[a-z0-9]+)*$ before deploying.","Be aware of the inverted ternary: the message without a name appears when name IS set."],"exampleFix":"// before\no.BlobContainerName = \"MyLeases\"; // uppercase invalid\n\n// after\no.BlobContainerName = \"lease-container\";","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 error message omits the provider name even when it's set.","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"}