{"record":{"id":"bd655ee3c279e92b","repo":"apache/cassandra","slug":"invalid-data-rate-value-accepted-units-mib-s","errorCode":null,"errorMessage":"Invalid data rate: ${value} Accepted units: MiB/s, KiB/s, B/s where case matters and only non-negative values are valid","messagePattern":"Invalid data rate: (.+?) Accepted units: MiB/s, KiB/s, B/s where case matters and only non-negative values are valid","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DataRateSpec.java","lineNumber":54,"sourceCode":" */\npublic abstract class DataRateSpec\n{\n    /**\n     * The Regexp used to parse the rate provided as String in cassandra.yaml.\n     */\n    private static final Pattern UNITS_PATTERN = Pattern.compile(\"^(\\\\d+)(MiB/s|KiB/s|B/s)$\");\n\n    private final long quantity;\n\n    private final DataRateUnit unit;\n\n    private DataRateSpec(String value)\n    {\n        //parse the string field value\n        Matcher matcher = UNITS_PATTERN.matcher(value);\n\n        if (!matcher.find())\n            throw new IllegalArgumentException(\"Invalid data rate: \" + value + \" Accepted units: MiB/s, KiB/s, B/s where \" +\n                                                \"case matters and \" + \"only non-negative values are valid\");\n\n        quantity = Long.parseLong(matcher.group(1));\n        unit = DataRateUnit.fromSymbol(matcher.group(2));\n    }\n\n    private DataRateSpec(String value, DataRateUnit minUnit, long max)\n    {\n        this(value);\n\n        validateQuantity(value, quantity(), unit(), minUnit, max);\n    }\n\n    private DataRateSpec(long quantity, DataRateUnit unit, DataRateUnit minUnit, long max)\n    {\n        this.quantity = quantity;\n        this.unit = unit;\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DataRateSpec.java#L36-L72","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Use one of the accepted units exactly: MiB/s, KiB/s, or B/s (case-sensitive), e.g. 64MiB/s","Remove spaces between quantity and unit (e.g. 64MiB/s not 64 MiB/s)","Ensure the value is non-negative and has no extra characters","Check which config key you are setting; some legacy keys expect megabits via different handling"],"exampleFix":"# before\nstream_throughput_outbound_rate: 64MB/s\n# after\nstream_throughput_outbound_rate: 64MiB/s","handlingStrategy":"validation","validationCode":"java.util.regex.Pattern RATE = java.util.regex.Pattern.compile(\"^\\\\d+\\\\s*(MiB/s|KiB/s|B/s)$\");\nif (!RATE.matcher(cfgValue).matches())\n    throw new IllegalArgumentException(\"Data rate must match <n>{MiB,KiB,B}/s: \" + cfgValue);","typeGuard":null,"tryCatchPattern":"try {\n    rate = DataRateSpec.parseYamlType(value);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Invalid data rate in yaml: \" + value, e);\n    throw new ConfigurationException(\"Fix stream rate, expected e.g. 64MiB/s\", e);\n}","preventionTips":["Use exactly MiB/s, KiB/s, or B/s — case-sensitive, no internal spaces","Never use decimal units (MB/s, Gb/s) in Cassandra rate configs","Keep values non-negative"],"tags":["configuration","yaml","units"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}