dotnet/orleans · error · OrleansConfigurationException

Configuration for AzureBlobLeaseProviderOptions is invalid.

Error message

Configuration for AzureBlobLeaseProviderOptions 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 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.

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).
  2. Check appsettings.json or the configure delegate for the container name value and fix formatting.
  3. Test against the regex ^[a-z0-9]+(-[a-z0-9]+)*$ before deploying.
  4. Be aware of the inverted ternary: the message without a name appears when name IS set.

Example fix

// before
o.BlobContainerName = "MyLeases"; // uppercase invalid

// after
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 non-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 a non-empty name. Note the message omits the provider name due to the inverted ternary, making diagnosis slightly harder.

Related errors


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