{"record":{"id":"e08c6caa711bab51","repo":"apache/cassandra","slug":"invalid-data-storage-value-it-shouldn-t-be-mo","errorCode":null,"errorMessage":"Invalid data storage: ${value}. It shouldn't be more than ${max-1} in ${minUnit}","messagePattern":"Invalid data storage: (.+?)\\. It shouldn't be more than (.+?) in (.+?)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DataStorageSpec.java","lineNumber":103,"sourceCode":"\n    private static void validateMinUnit(DataStorageUnit sourceUnit, DataStorageUnit minUnit, String value)\n    {\n        if (sourceUnit.compareTo(minUnit) < 0)\n            throw new IllegalArgumentException(String.format(\"Invalid data storage: %s Accepted units:%s\", value, acceptedUnits(minUnit)));\n    }\n\n    private static String acceptedUnits(DataStorageUnit minUnit)\n    {\n        DataStorageUnit[] units = DataStorageUnit.values();\n        return Arrays.toString(Arrays.copyOfRange(units, minUnit.ordinal(), units.length));\n    }\n\n    private static void validateQuantity(String value, long quantity, DataStorageUnit sourceUnit, DataStorageUnit minUnit, long max)\n    {\n        // no need to validate for negatives as they are not allowed at first place from the regex\n\n        if (minUnit.convert(quantity, sourceUnit) >= max)\n            throw new IllegalArgumentException(\"Invalid data storage: \" + value + \". It shouldn't be more than \" +\n                                               (max - 1) + \" in \" + toLowerCaseLocalized(minUnit.name()));\n    }\n\n    private static void validateQuantity(long quantity, DataStorageUnit sourceUnit, DataStorageUnit minUnit, long max)\n    {\n        if (quantity < 0)\n            throw new IllegalArgumentException(\"Invalid data storage: value must be non-negative\");\n\n        if (minUnit.convert(quantity, sourceUnit) >= max)\n            throw new IllegalArgumentException(String.format(\"Invalid data storage: %d %s. It shouldn't be more than %d in %s\",\n                                                             quantity, toLowerCaseLocalized(sourceUnit.name()),\n                                                             max - 1, toLowerCaseLocalized(minUnit.name())));\n    }\n\n    // get vs no-get prefix is not consistent in the code base, but for classes involved with config parsing, it is\n    // imporant to be explicit about get/set as this changes how parsing is done; this class is a data-type, so is\n    // not nested, having get/set can confuse parsing thinking this is a nested type\n    /**","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DataStorageSpec.java#L85-L121","documentation":"DataStorageSpec parses Cassandra config values with data-storage units (e.g. 512MiB, 1GiB). This error is thrown when a parsed quantity, converted to the minimum allowed unit for that spec, equals or exceeds the maximum bound — the value is simply too large for the setting.","triggerScenarios":"Constructing a DataStorageSpec subclass (e.g. DataStorageSpec.DataStorageBytesBound) from a string via ConfigParser, or programmatically via the long constructor, where minUnit.convert(quantity, sourceUnit) >= max — e.g. a value that overflows or exceeds Long.MAX_VALUE when normalized.","commonSituations":"A cassandra.yaml value like max_mutation_size_in_kb set far beyond bounds, pasted example configs with absurd sizes, or unit confusion (entering bytes where MiB was expected, producing a huge number).","solutions":["Reduce the value in cassandra.yaml so it is below the documented maximum for that setting","Use a larger unit to express the same size (e.g. 2GiB instead of 2147483648 bytes) so the numeric literal stays in range","Check for unit confusion: verify the suffix (B, KiB, MiB, GiB) matches what you intend"],"exampleFix":"// before (cassandra.yaml)\nmax_mutation_size_in_kb: 999999999999\n// after\nmax_mutation_size_in_kb: 16384","handlingStrategy":"validation","validationCode":"long valueInUnits = unit.convert(quantity, TimeUnit-like source); if (valueInUnits >= MAX_BOUND) throw new IllegalArgumentException(value + \" exceeds max \" + (MAX_BOUND - 1));","typeGuard":null,"tryCatchPattern":"try { new DataStorageSpec.DataStorageBytesBound(confValue); } catch (IllegalArgumentException e) { log.error(\"bad size config: {}\", e.getMessage()); }","preventionTips":["Keep storage values well below documented maximums","Use the largest sensible unit (MiB/GiB) to avoid huge numerics","Validate cassandra.yaml values in CI with a config parse test"],"tags":["cassandra","config","data-storage-spec","value-out-of-range"],"backgroundTag":"value-out-of-range","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"}