dotnet/orleans · error · OrleansConfigurationException

Configuration for AzureBlobLeaseProviderOptions {name} is in

Error message

Configuration for AzureBlobLeaseProviderOptions {name} is invalid. BlobContainerName is not valid

What it means

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.

Source

Thrown at src/Azure/Orleans.Streaming.AzureStorage/Options/AzureBlobLeaseProviderOptions.cs:167

            {
                throw new OrleansConfigurationException($"Named option {nameof(AzureBlobLeaseProviderOptions)} of name {this.name} is invalid.  Name cannot be empty or whitespace.");
            }

            if (this.options.CreateClient is null)
            {
                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.");
            }

            try
            {
                AzureBlobUtils.ValidateContainerName(this.options.BlobContainerName);
            }
            catch (ArgumentException e)
            {
                var errorStr = string.IsNullOrEmpty(this.name)
                    ? $"Configuration for {nameof(AzureBlobLeaseProviderOptions)} {this.name} is invalid. {nameof(this.options.BlobContainerName)} is not valid"
                    : $"Configuration for {nameof(AzureBlobLeaseProviderOptions)} is invalid. {nameof(this.options.BlobContainerName)} is not valid";
                throw new OrleansConfigurationException(errorStr , e);
            }
        }
    }

}

View on GitHub (pinned to fca799fa70)

Solutions

  1. Set BlobContainerName to a valid lowercase alphanumeric string (3-63 chars, optional single hyphens) in the options delegate.
  2. Ensure the lease provider is registered with a proper non-empty name.
  3. Verify the container name in appsettings.json matches Azure naming rules.
  4. Be aware of the inverted ternary: the message with a name appears when name IS empty, not when it's set.

Example fix

// before
siloBuilder.AddAzureBlobLeaseProvider("blobLeases", o =>
{
    o.BlobContainerName = "Lease_Container"; // uppercase + underscore invalid
});

// after
siloBuilder.AddAzureBlobLeaseProvider("blobLeases", o =>
{
    o.BlobContainerName = "lease-container";
});
Defensive patterns

Strategy: validation

Validate before calling

// Validate container name before registration
var containerName = "lease-container";
if (!System.Text.RegularExpressions.Regex.IsMatch(containerName, @"^[a-z0-9]+(-[a-z0-9]+)*$")
    || containerName.Length < 3 || containerName.Length > 63)
    throw new InvalidOperationException($"Invalid blob container name: '{containerName}'");

Try / catch

try { await host.StartAsync(ct); }
catch (OrleansConfigurationException ex) when (ex.Message.Contains("BlobContainerName is not valid"))
{
    logger.LogError(ex, "Blob lease provider container name is invalid — use 3-63 lowercase alphanumeric chars with hyphens.");
    throw;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of dotnet/orleans@fca799fa70 (2026-08-13). Data as JSON: /api/errors/f9f774e85c41a151. Report an issue: GitHub.