dotnet/orleans · critical · OrleansConfigurationException

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

Error message

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

What it means

Thrown by EventHubOptionsValidator.ValidateConfiguration at startup when options.CreateConnection is set but options.ConsumerGroup is null or empty. The receiver requires a consumer group to attach to a partition.

Source

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

    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;
        public StreamCheckpointerConfigurationValidator(IServiceProvider services, string name)
        {
            this.services = services;
            this.name = name;
        }

View on GitHub (pinned to fca799fa70)

Solutions

  1. Ensure ConsumerGroup is set, typically to "$Default".
  2. Validate the configuration binding section for the consumer group key.
  3. Set options.ConsumerGroup explicitly after binding from config.

Example fix

// before
// config section missing ConsumerGroup -> empty after bind

// after
options.ConsumerGroup = config["ConsumerGroup"] ?? "$Default";
Defensive patterns

Strategy: validation

Validate before calling

if (string.IsNullOrEmpty(options.ConsumerGroup))
    options.ConsumerGroup = "$Default";

Type guard

static bool HasConsumerGroup(EventHubOptions o) => !string.IsNullOrEmpty(o.ConsumerGroup);

Prevention

When it happens

Trigger: ConfigureEventHubConnection was called with a consumer group, but a later configuration step (or direct property set) left ConsumerGroup empty before validation.

Common situations: Binding EventHubOptions from configuration where the ConsumerGroup key is missing; a custom config builder that overwrites ConsumerGroup with an empty string.

Related errors


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