{"record":{"id":"782e4a8a099a142b","repo":"apache/cassandra","slug":"unsupported-data-rate-unit-s-supported-units-ar","errorCode":null,"errorMessage":"Unsupported data rate unit: %s. Supported units are: %s","messagePattern":"Unsupported data rate unit: (.+?)\\. Supported units are: (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DataRateSpec.java","lineNumber":389,"sourceCode":"            assert (over > 0.0) && (over < (MAX - 1)) && (over == (MAX / m));\n\n            if (d > over)\n                return MAX;\n            return d * m;\n        }\n\n        /**\n         * @param symbol the unit symbol\n         * @return the rate unit corresponding to the given symbol\n         */\n        public static DataRateUnit fromSymbol(String symbol)\n        {\n            for (DataRateUnit value : values())\n            {\n                if (value.symbol.equalsIgnoreCase(symbol))\n                    return value;\n            }\n            throw new IllegalArgumentException(String.format(\"Unsupported data rate unit: %s. Supported units are: %s\",\n                                                             symbol, Arrays.stream(values())\n                                                                           .map(u -> u.symbol)\n                                                                           .collect(Collectors.joining(\", \"))));\n        }\n\n        /**\n         * The unit symbol\n         */\n        private final String symbol;\n\n        DataRateUnit(String symbol)\n        {\n            this.symbol = symbol;\n        }\n\n        public double toBytesPerSecond(double d)\n        {\n            throw new AbstractMethodError();","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DataRateSpec.java#L371-L407","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use exactly one of the listed supported units from the exception message (e.g. MiB/s)","Convert the desired rate into a supported unit (e.g. 2Gb/s -> 250MiB/s)","Match case-insensitively is allowed by fromSymbol, so check spelling/scale first, not case","Inspect DataRateUnit.values() symbols if programmatically validating before parse"],"exampleFix":"# before\nstream_throughput_outbound_rate: 64Gb/s\n# after\nstream_throughput_outbound_rate: 8000MiB/s","handlingStrategy":"validation","validationCode":"boolean ok = java.util.Arrays.stream(DataRateSpec.DataRateUnit.values())\n    .anyMatch(u -> u.symbol.equalsIgnoreCase(unitToken));\nif (!ok) throw new IllegalArgumentException(\"Unsupported rate unit: \" + unitToken);","typeGuard":null,"tryCatchPattern":"try {\n    unit = DataRateSpec.DataRateUnit.fromSymbol(symbol);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Unsupported rate unit: \" + symbol, e);\n    unit = DataRateSpec.DataRateUnit.BYTES_PER_SECOND;\n}","preventionTips":["Only use units listed by DataRateUnit (B/s, KiB/s, MiB/s)","Convert larger-scale requests (Gb/s, Tb/s) into supported units yourself","Remember case is insensitive for the symbol but spelling/scale must match"],"tags":["configuration","units","enum"],"backgroundTag":"invalid-enum-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"}