dotnet/orleans · error · OrleansConfigurationException

Configuration for DynamoDBGrainStorage {name} is invalid. Wr

Error message

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

What it means

Thrown by DynamoDBGrainStorageOptionsValidator.ValidateConfiguration at startup when UseProvisionedThroughput is enabled but WriteCapacityUnits is 0. It is the write-side counterpart to the ReadCapacityUnits check; both must be positive under provisioned throughput.

Source

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

        {
            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.WriteCapacityUnits to a positive value whenever UseProvisionedThroughput is true.
  2. Use on-demand mode (UseProvisionedThroughput = false) if you do not want to manage capacities.
  3. Validate both capacity values are non-zero in your hosting setup before the silo starts.

Example fix

// before
o.UseProvisionedThroughput = true;
o.ReadCapacityUnits = 50; // WriteCapacityUnits still 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 write capacity
if (options.UseProvisionedThroughput && options.WriteCapacityUnits <= 0)
    throw new InvalidOperationException("Set WriteCapacityUnits > 0 or disable UseProvisionedThroughput.");

Type guard

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

Try / catch

null

Prevention

When it happens

Trigger: Configuring DynamoDB storage with options.UseProvisionedThroughput = true and WriteCapacityUnits left at 0 or set to 0.

Common situations: Setting only ReadCapacityUnits when enabling provisioned throughput; reading the value from a config key that is absent; migrating from on-demand without setting write capacity.

Related errors


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