{"record":{"id":"dd65e901c6566f68","repo":"dotnet/orleans","slug":"configuration-for-azureblobstorageoptions-name-i","errorCode":null,"errorMessage":"Configuration for AzureBlobStorageOptions {name} is invalid. ContainerName is not valid","messagePattern":"Configuration for AzureBlobStorageOptions (.+?) is invalid\\. ContainerName is not valid","errorType":"exception","errorClass":"OrleansConfigurationException","httpStatus":null,"severity":"error","filePath":"src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/AzureBlobStorageOptions.cs","lineNumber":158,"sourceCode":"            this.options = options;\n            this.name = name;\n        }\n\n        public void ValidateConfiguration()\n        {\n            if (this.options.CreateClient is null)\n            {\n                throw new OrleansConfigurationException($\"No credentials specified. Use the {options.GetType().Name}.{nameof(AzureBlobStorageOptions.ConfigureBlobServiceClient)} method to configure the Azure Blob Service client.\");\n            }\n\n            try\n            {\n                AzureBlobUtils.ValidateContainerName(options.ContainerName);\n                AzureBlobUtils.ValidateBlobName(this.name);\n            }\n            catch (ArgumentException e)\n            {\n                throw new OrleansConfigurationException(\n                    $\"Configuration for AzureBlobStorageOptions {name} is invalid. {nameof(this.options.ContainerName)} is not valid\", e);\n            }\n        }\n    }\n}\n","sourceCodeStart":140,"sourceCodeEnd":164,"githubUrl":"https://github.com/dotnet/orleans/blob/fca799fa70ecb6ad975224271703ca43221f58de/src/Azure/Orleans.Persistence.AzureStorage/Providers/Storage/AzureBlobStorageOptions.cs#L140-L164","documentation":"Thrown by AzureBlobStorageOptionsValidator.ValidateConfiguration() when AzureBlobUtils.ValidateContainerName or ValidateBlobName raises an ArgumentException, wrapped into an OrleansConfigurationException. The container name must be 3-63 chars, lowercase alphanumeric with single hyphens (regex ^[a-z0-9]+(-[a-z0-9]+)*$). The blob name (which is the provider option name) must be non-empty, max 1024 chars, max 253 slashes.","triggerScenarios":"Fires during ValidateConfiguration() when options.ContainerName fails the container regex (e.g., uppercase letters, underscores, too short) or when the option name string fails blob name validation. ValidateContainerName runs first; if it throws, the catch wraps it.","commonSituations":"Container name set to a value with uppercase characters (e.g., \"MyGrainState\"), too short (less than 3 chars), or containing invalid characters like underscores. Using a default name that is empty or whitespace. Migration from an emulator where naming rules were not enforced.","solutions":["Set ContainerName to a lowercase alphanumeric string of 3-63 characters with optional single hyphens (e.g., \"grain-state\").","Ensure the storage provider name passed to AddAzureBlobGrainStorage is non-empty and under 1024 characters.","Check appsettings.json for the ContainerName value and fix any uppercase or special characters.","Test the name against the regex ^[a-z0-9]+(-[a-z0-9]+)*$ before deploying."],"exampleFix":"// before\no.ContainerName = \"MyGrainState_Data\"; // uppercase + underscore invalid\n\n// after\no.ContainerName = \"grain-state\";","handlingStrategy":"validation","validationCode":"// Validate container name before silo start\nvar containerName = configuration[\"Orleans:Persistence:grainStore:ContainerName\"];\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 container name: '{containerName}'\");","typeGuard":null,"tryCatchPattern":"try { await host.StartAsync(ct); }\ncatch (OrleansConfigurationException ex) when (ex.Message.Contains(\"ContainerName is not valid\"))\n{\n    logger.LogError(\"Azure Blob container name is invalid — must be 3-63 lowercase alphanumeric with hyphens.\");\n    throw;\n}","preventionTips":["Always set ContainerName explicitly to a known-valid value.","Use a naming convention helper that enforces the regex at compile/config time.","Add a startup health check that validates container name format.","Never use uppercase or underscores in Azure container names."],"tags":["azure","blob-storage","configuration","validation","naming-rules","orleans"],"backgroundTag":null,"analyzedSha":"fca799fa70ecb6ad975224271703ca43221f58de","analyzedAt":"2026-08-13T19:55:57.938Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}