BerriAI/litellm · error · Exception

Invalid args passed in. Need to set both read_capacity_units

Error message

Invalid args passed in. Need to set both read_capacity_units and write_capacity_units. Args passed in - {database_arguments}

What it means

Validation of DynamoDB billing args: billing_mode is PROVISIONED_THROUGHPUT but read_capacity_units/write_capacity_units are not both supplied as ints, so table throughput cannot be set; the passed args are embedded.

Source

Thrown at litellm/proxy/db/dynamo_db.py:35

    def __init__(self, database_arguments: DynamoDBArgs):
        from aiodynamo.models import PayPerRequest, Throughput

        self.throughput_type = None
        if database_arguments.billing_mode == "PAY_PER_REQUEST":
            self.throughput_type = PayPerRequest()
        elif database_arguments.billing_mode == "PROVISIONED_THROUGHPUT":
            if (
                database_arguments.read_capacity_units is not None
                and isinstance(database_arguments.read_capacity_units, int)
                and database_arguments.write_capacity_units is not None
                and isinstance(database_arguments.write_capacity_units, int)
            ):
                self.throughput_type = Throughput(
                    read=database_arguments.read_capacity_units,
                    write=database_arguments.write_capacity_units,
                )
            else:
                raise Exception(
                    f"Invalid args passed in. Need to set both read_capacity_units and write_capacity_units. Args passed in - {database_arguments}"
                )
        self.database_arguments = database_arguments
        self.region_name = database_arguments.region_name

    def set_env_vars_based_on_arn(self):
        if self.database_arguments.aws_role_name is None:
            return
        verbose_proxy_logger.debug("DynamoDB: setting env vars based on arn=%s", self.database_arguments.aws_role_name)
        import os

        import boto3

        sts_client: Final = boto3.client("sts")

        # call 1
        sts_client.assume_role_with_web_identity(
            RoleArn=self.database_arguments.aws_role_name,

View on GitHub (pinned to 77b7c6c40c)

Solutions

  1. Pass both read_capacity_units and write_capacity_units in the database arguments.

Example fix

database_arguments: {read_capacity_units: 5, write_capacity_units: 5}
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at litellm/proxy/db/dynamo_db.py:35 when the library encounters an invalid state.

Common situations: Only one of read_capacity_units/write_capacity_units was provided for the DynamoDB table.


AI-assisted analysis of BerriAI/litellm@77b7c6c40c (2026-08-18). Data as JSON: /api/errors/ed79b7799b67a8d9. Report an issue: GitHub.