dotnet/orleans · critical · InvalidOperationException

{key} is not configured.

Error message

{key} is not configured.

What it means

An InvalidOperationException thrown by the generic GetRequiredValue helper in AzureTableServiceClientFactory when a requested configuration key (e.g., AZURE_CLIENT_ID, or any key passed by the endpoint-config extension) is null or whitespace. It is the shared fail-fast guard for any required setting read through this helper.

Source

Thrown at samples/Deployment/AzureContainerApps/Infrastructure/AzureTableServiceClientFactory.cs:51

        var connectionString = configuration["AzureTable:ConnectionString"];
        if (environment.IsDevelopment()
            && string.Equals(connectionString, "UseDevelopmentStorage=true", StringComparison.OrdinalIgnoreCase))
        {
            return new TableServiceClient(connectionString);
        }

        throw new InvalidOperationException(
            "Configure AzureTable:ServiceUri for Azure, or use Azurite with "
            + "AzureTable:ConnectionString=UseDevelopmentStorage=true in Development.");
    }

    public static string GetRequiredValue(IConfiguration configuration, string key)
    {
        var value = configuration[key];
        return !string.IsNullOrWhiteSpace(value)
            ? value
            : throw new InvalidOperationException($"{key} is not configured.");
    }
}

View on GitHub (pinned to fca799fa70)

Solutions

  1. Set the configuration key named in the {key} placeholder to a non-empty value in the container app/environment.
  2. Audit the deployment manifest (Bicep/manifests) to ensure every key read via GetRequiredValue is provisioned.
  3. Add a config-validation step at startup that lists all required keys and their resolved status.

Example fix

// before
public static string GetRequiredValue(IConfiguration configuration, string key)
{
    var value = configuration[key];
    return !string.IsNullOrWhiteSpace(value)
        ? value
        : throw new InvalidOperationException($"{key} is not configured.");
}

// after (collect all missing keys)
public static string GetRequiredValue(IConfiguration configuration, string key) =>
    configuration[key] is { Length: > 0 } value && !value.All(char.IsWhiteSpace)
        ? value
        : throw new InvalidOperationException($"{key} is not configured. Check app settings / env vars.");
Defensive patterns

Strategy: validation

Validate before calling

foreach (var key in new[] { "AZURE_CLIENT_ID", "Orleans:AdvertisedSiloPort", "Orleans:AdvertisedGatewayPort" }) {
    if (string.IsNullOrWhiteSpace(configuration[key]))
        throw new InvalidOperationException($"{key} is not configured.");
}

Prevention

When it happens

Trigger: GetRequiredValue is called for a key whose IConfiguration value is null/empty/whitespace. Currently called for AZURE_CLIENT_ID (when ServiceUri is set) and from OrleansEndpointConfigurationExtensions for the advertised ports.

Common situations: A required env var/app-setting not provisioned in the container app. Key renamed in code but not in the deployment manifest. Local run missing the variable.

Related errors


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