apache/cassandra · error · IllegalArgumentException

Unsupported data rate unit: %s. Supported units are: %s

Error message

Unsupported data rate unit: %s. Supported units are: %s

What it means

DataRateUnit.fromSymbol looks up a rate unit by its case-insensitive symbol (B/s, KiB/s, MiB/s). If no enum constant matches, it throws this IllegalArgumentException listing all supported symbols. It is reached from DataRateSpec parsing when the regex matched a number but the unit token is unknown.

Source

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

            assert (over > 0.0) && (over < (MAX - 1)) && (over == (MAX / m));

            if (d > over)
                return MAX;
            return d * m;
        }

        /**
         * @param symbol the unit symbol
         * @return the rate unit corresponding to the given symbol
         */
        public static DataRateUnit fromSymbol(String symbol)
        {
            for (DataRateUnit value : values())
            {
                if (value.symbol.equalsIgnoreCase(symbol))
                    return value;
            }
            throw new IllegalArgumentException(String.format("Unsupported data rate unit: %s. Supported units are: %s",
                                                             symbol, Arrays.stream(values())
                                                                           .map(u -> u.symbol)
                                                                           .collect(Collectors.joining(", "))));
        }

        /**
         * The unit symbol
         */
        private final String symbol;

        DataRateUnit(String symbol)
        {
            this.symbol = symbol;
        }

        public double toBytesPerSecond(double d)
        {
            throw new AbstractMethodError();

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use exactly one of the listed supported units from the exception message (e.g. MiB/s)
  2. Convert the desired rate into a supported unit (e.g. 2Gb/s -> 250MiB/s)
  3. Match case-insensitively is allowed by fromSymbol, so check spelling/scale first, not case
  4. Inspect DataRateUnit.values() symbols if programmatically validating before parse

Example fix

# before
stream_throughput_outbound_rate: 64Gb/s
# after
stream_throughput_outbound_rate: 8000MiB/s
Defensive patterns

Strategy: validation

Validate before calling

boolean ok = java.util.Arrays.stream(DataRateSpec.DataRateUnit.values())
    .anyMatch(u -> u.symbol.equalsIgnoreCase(unitToken));
if (!ok) throw new IllegalArgumentException("Unsupported rate unit: " + unitToken);

Try / catch

try {
    unit = DataRateSpec.DataRateUnit.fromSymbol(symbol);
} catch (IllegalArgumentException e) {
    logger.error("Unsupported rate unit: " + symbol, e);
    unit = DataRateSpec.DataRateUnit.BYTES_PER_SECOND;
}

Prevention

When it happens

Trigger: Config values like '64Gb/s', '64 MB/s', or '64TiB/s' where the regex-matched unit token is not one of the defined rate units.

Common situations: Using decimal units (GB/s) instead of binary (GiB/s); requesting Tb/s or larger units that the enum does not define; typos like 'mib/s' that pass a lenient mental model but fail the symbol table.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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