dotnet/orleans · critical · OrleansConfigurationException

Azure Event Hub connection not configured for stream provide

Error message

Azure Event Hub connection not configured for stream provider options EventHubOptions with name "{name}". Use the {options.GetType().Name}.ConfigureEventHubConnection method to configure the connection.

What it means

Thrown by EventHubOptionsValidator.ValidateConfiguration during silo/client startup when options.CreateConnection is still null, meaning no ConfigureEventHubConnection overload was ever called. The streaming provider cannot function without a connection factory.

Source

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

                throw new ArgumentException("A non-null, non-empty value must be provided.", nameof(consumerGroup));
            }
        }
    }

    public class EventHubOptionsValidator : IConfigurationValidator
    {
        private readonly EventHubOptions options;
        private readonly string name;
        public EventHubOptionsValidator(EventHubOptions options, string name)
        {
            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;

View on GitHub (pinned to fca799fa70)

Solutions

  1. Add a .ConfigureEventHubConnection(...) call to the EventHubOptions for the matching provider name.
  2. Verify the options name used in AddEventHubStreams matches the name passed to the validator.
  3. If migrating from connection strings, switch to one of the ConfigureEventHubConnection overloads (instance, endpoint+token, or delegate).

Example fix

// before
siloBuilder.AddEventHubStreams("EventHubStream", c => { /* no ConfigureEventHubConnection */ });

// after
siloBuilder.AddEventHubStreams("EventHubStream", c =>
{
    c.ConfigureEventHubConnection(
        new CreateConnectionDelegate(opts => new EventHubConnection(fqdn, hub, credential, opts)),
        hubName, "$Default");
});
Defensive patterns

Strategy: validation

Validate before calling

if (options.CreateConnection is null)
    throw new OrleansConfigurationException("Configure EventHub connection before startup.");

Type guard

static bool IsConfigured(EventHubOptions o) => o.CreateConnection is not null;

Prevention

When it happens

Trigger: Registering a PersistentStreamProvider with EventHub adapter but never invoking ConfigureEventHubConnection on the EventHubOptions for that provider name.

Common situations: Missing .ConfigureEventHubConnection(...) call in the stream provider configuration pipeline; configuring on the wrong options name; upgrading to a version that made the connection explicit instead of connection-string-based.

Related errors


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