dotnet/orleans · critical · OrleansConfigurationException

EventHubOptions on stream provider {this.name} is invalid. E

Error message

EventHubOptions on stream provider {this.name} is invalid. EventHubOptions.EventHubName is invalid

What it means

Thrown by EventHubOptionsValidator.ValidateConfiguration at startup when options.CreateConnection is set but options.EventHubName is null or empty. The provider needs the hub name to address the correct Event Hub.

Source

Thrown at src/Azure/Orleans.Streaming.EventHubs/Providers/Streams/EventHub/EventHubStreamOptions.cs:188

        {
            this.options = options;
            this.name = name;
        }
        public void ValidateConfiguration()
        {
            if (options.CreateConnection is null)
            {
                throw new OrleansConfigurationException($"Azure Event Hub connection not configured for stream provider options {nameof(EventHubOptions)} with name \"{name}\". Use the {options.GetType().Name}.{nameof(EventHubOptions.ConfigureEventHubConnection)} method to configure the connection.");
            }

            if (string.IsNullOrEmpty(options.ConsumerGroup))
            {
                throw new OrleansConfigurationException($"{nameof(EventHubOptions)} on stream provider {this.name} is invalid. {nameof(EventHubOptions.ConsumerGroup)} is invalid");
            }

            if (string.IsNullOrEmpty(options.EventHubName))
            {
                throw new OrleansConfigurationException($"{nameof(EventHubOptions)} on stream provider {this.name} is invalid. {nameof(EventHubOptions.EventHubName)} is invalid");
            }
        }
    }

    public class StreamCheckpointerConfigurationValidator : IConfigurationValidator
    {
        private readonly IServiceProvider services;
        private readonly string name;
        public StreamCheckpointerConfigurationValidator(IServiceProvider services, string name)
        {
            this.services = services;
            this.name = name;
        }
        public void ValidateConfiguration()
        {
            var checkpointerFactory = services.GetKeyedService<IStreamQueueCheckpointerFactory>(this.name);
            if (checkpointerFactory == null)
                throw new OrleansConfigurationException($"No IStreamQueueCheckpointer is configured with PersistentStreamProvider {this.name}. Please configure one.");

View on GitHub (pinned to fca799fa70)

Solutions

  1. Set options.EventHubName to the target hub name.
  2. When using the delegate overload ConfigureEventHubConnection(CreateConnectionDelegate, string, string), pass the hub name as the second argument.
  3. Verify the configuration section contains the EventHubName key.

Example fix

// before
options.ConfigureEventHubConnection(factory, "", consumerGroup);

// after
options.ConfigureEventHubConnection(factory, "my-hub", consumerGroup);
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(options.EventHubName))
    throw new OrleansConfigurationException("EventHubName required");

Type guard

static bool HasEventHubName(EventHubOptions o) => !string.IsNullOrEmpty(o.EventHubName);

Prevention

When it happens

Trigger: ConfigureEventHubConnection assigned a delegate but EventHubName was not retained, or a configuration binding left EventHubName empty.

Common situations: Using the delegate overload and forgetting to also set EventHubName; config binding to a misnamed key.

Related errors


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