dotnet/orleans · error · OrleansConfigurationException

Configuration for DynamoDBGrainStorage {name} is invalid. Re

Error message

Configuration for DynamoDBGrainStorage {name} is invalid. ReadCapacityUnits is not valid.

What it means

Thrown by DynamoDBGrainStorageOptionsValidator.ValidateConfiguration at startup when UseProvisionedThroughput is enabled but ReadCapacityUnits is 0. Provisioned throughput mode requires explicit read/write capacity, so a zero read capacity is treated as misconfiguration.

Source

Thrown at src/AWS/Orleans.Persistence.DynamoDB/Options/DynamoDBStorageOptions.cs:93

        /// </summary>
        /// <param name="options">The option to be validated.</param>
        /// <param name="name">The option name to be validated.</param>
        public DynamoDBGrainStorageOptionsValidator(DynamoDBStorageOptions options, string name)
        {
            this.options = options;
            this.name = name;
        }

        public void ValidateConfiguration()
        {
            if (string.IsNullOrWhiteSpace(this.options.TableName))
                throw new OrleansConfigurationException(
                    $"Configuration for DynamoDBGrainStorage {this.name} is invalid. {nameof(this.options.TableName)} is not valid.");

            if (this.options.UseProvisionedThroughput)
            {
                if (this.options.ReadCapacityUnits == 0)
                    throw new OrleansConfigurationException(
                        $"Configuration for DynamoDBGrainStorage {this.name} is invalid. {nameof(this.options.ReadCapacityUnits)} is not valid.");

                if (this.options.WriteCapacityUnits == 0)
                    throw new OrleansConfigurationException(
                        $"Configuration for DynamoDBGrainStorage {this.name} is invalid. {nameof(this.options.WriteCapacityUnits)} is not valid.");
            }
        }
    }
}

View on GitHub (pinned to fca799fa70)

Solutions

  1. Set options.ReadCapacityUnits to a positive value when UseProvisionedThroughput is true.
  2. If you want on-demand billing, leave UseProvisionedThroughput = false so capacity units are not validated.
  3. Confirm the capacity values are populated from configuration before the validator runs.

Example fix

// before
o.UseProvisionedThroughput = true; // ReadCapacityUnits left at 0 -> throws

// after
o.UseProvisionedThroughput = true;
o.ReadCapacityUnits = 50;
o.WriteCapacityUnits = 10;
Defensive patterns

Strategy: validation

Validate before calling

// If using provisioned throughput, ensure a positive read capacity
if (options.UseProvisionedThroughput && options.ReadCapacityUnits <= 0)
    throw new InvalidOperationException("Set ReadCapacityUnits > 0 or disable UseProvisionedThroughput.");

Type guard

static bool IsValidProvisioned(DynamoDBStorageOptions o)
    => !o.UseProvisionedThroughput || o.ReadCapacityUnits > 0;

Try / catch

null

Prevention

When it happens

Trigger: Configuring DynamoDB storage with options.UseProvisionedThroughput = true while leaving ReadCapacityUnits at its default 0 (or explicitly setting it to 0).

Common situations: Switching from on-demand to provisioned billing and forgetting to set capacities; copying options where only WriteCapacityUnits was set; reading capacity from a config key that resolves to 0.

Related errors


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