apache/cassandra · error · IllegalArgumentException

Invalid data rate: ${value} Accepted units: MiB/s, KiB/s, B/

Error message

Invalid data rate: ${value} Accepted units: MiB/s, KiB/s, B/s where case matters and only non-negative values are valid

What it means

DataRateSpec's string constructor parses config values like '64MiB/s'. If the value does not match the UNITS_PATTERN regex (a non-negative number followed by a recognized rate unit), an IllegalArgumentException is thrown listing the accepted units. This occurs while parsing cassandra.yaml rate settings.

Source

Thrown at src/java/org/apache/cassandra/config/DataRateSpec.java:54

 */
public abstract class DataRateSpec
{
    /**
     * The Regexp used to parse the rate provided as String in cassandra.yaml.
     */
    private static final Pattern UNITS_PATTERN = Pattern.compile("^(\\d+)(MiB/s|KiB/s|B/s)$");

    private final long quantity;

    private final DataRateUnit unit;

    private DataRateSpec(String value)
    {
        //parse the string field value
        Matcher matcher = UNITS_PATTERN.matcher(value);

        if (!matcher.find())
            throw new IllegalArgumentException("Invalid data rate: " + value + " Accepted units: MiB/s, KiB/s, B/s where " +
                                                "case matters and " + "only non-negative values are valid");

        quantity = Long.parseLong(matcher.group(1));
        unit = DataRateUnit.fromSymbol(matcher.group(2));
    }

    private DataRateSpec(String value, DataRateUnit minUnit, long max)
    {
        this(value);

        validateQuantity(value, quantity(), unit(), minUnit, max);
    }

    private DataRateSpec(long quantity, DataRateUnit unit, DataRateUnit minUnit, long max)
    {
        this.quantity = quantity;
        this.unit = unit;

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use one of the accepted units exactly: MiB/s, KiB/s, or B/s (case-sensitive), e.g. 64MiB/s
  2. Remove spaces between quantity and unit (e.g. 64MiB/s not 64 MiB/s)
  3. Ensure the value is non-negative and has no extra characters
  4. Check which config key you are setting; some legacy keys expect megabits via different handling

Example fix

# before
stream_throughput_outbound_rate: 64MB/s
# after
stream_throughput_outbound_rate: 64MiB/s
Defensive patterns

Strategy: validation

Validate before calling

java.util.regex.Pattern RATE = java.util.regex.Pattern.compile("^\\d+\\s*(MiB/s|KiB/s|B/s)$");
if (!RATE.matcher(cfgValue).matches())
    throw new IllegalArgumentException("Data rate must match <n>{MiB,KiB,B}/s: " + cfgValue);

Try / catch

try {
    rate = DataRateSpec.parseYamlType(value);
} catch (IllegalArgumentException e) {
    logger.error("Invalid data rate in yaml: " + value, e);
    throw new ConfigurationException("Fix stream rate, expected e.g. 64MiB/s", e);
}

Prevention

When it happens

Trigger: YAML values such as stream_throughput_outbound_rate: 64MB/s (unaccepted unit), '64 MiB/s' (space inside), '64MiB' (missing /s), or 'mib/s' (wrong case, since case matters).

Common situations: Editing cassandra.yaml to tune streaming throughput; migrating configs between Cassandra versions where rate units became required; copy-pasting values like '100mbit' or bare numbers with no unit from blog posts.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/bd655ee3c279e92b. Report an issue: GitHub.