{"record":{"id":"8a54dca4aa647045","repo":"apache/cassandra","slug":"invalid-data-storage-value-accepted-units-ac","errorCode":null,"errorMessage":"Invalid data storage: ${value} Accepted units:${acceptedUnits(minUnit)} where case matters and only non-negative values are accepted","messagePattern":"Invalid data storage: (.+?) Accepted units:(.+?) where case matters and only non-negative values are accepted","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DataStorageSpec.java","lineNumber":73,"sourceCode":"        validateMinUnit(unit, minUnit, value);\n        validateQuantity(quantity, unit, minUnit, max);\n    }\n\n    private DataStorageSpec(String value, DataStorageUnit minUnit)\n    {\n        //parse the string field value\n        Matcher matcher = UNITS_PATTERN.matcher(value);\n\n        if (matcher.find())\n        {\n            quantity = Long.parseLong(matcher.group(1));\n            unit = DataStorageUnit.fromSymbol(matcher.group(2));\n\n            // this constructor is used only by extended classes for min unit; upper bound and min unit are guarded there accordingly\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"Invalid data storage: \" + value + \" Accepted units:\" + acceptedUnits(minUnit) +\n                                               \" where case matters and only non-negative values are accepted\");\n        }\n    }\n\n    private DataStorageSpec(String value, DataStorageUnit minUnit, long max)\n    {\n        this(value, minUnit);\n\n        validateMinUnit(unit, minUnit, value);\n        validateQuantity(value, quantity(), unit(), minUnit, max);\n    }\n\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","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DataStorageSpec.java#L55-L91","documentation":"DataStorageSpec's string constructor parses storage sizes like '10GiB'. If the value does not match the expected pattern (non-negative number plus a storage unit accepted for the min unit), it throws this IllegalArgumentException listing the accepted units. Raised while parsing cassandra.yaml storage-size settings.","triggerScenarios":"YAML values like commitlog_total_space_in_mb: '10GB' with disallowed unit/case ('gb' lowercase where case matters), '10 GiB' with a space, '10GiB/month' with junk suffix, or a negative number that the regex rejects.","commonSituations":"Editing cassandra.yaml disk settings; copy-pasting from tools that use decimal units (GB) when only binary units are accepted; adding trailing comments on the same line as the value.","solutions":["Use an accepted unit exactly as listed in the message, matching case (e.g. 10GiB, 512MiB, 2048KiB, 100B)","Remove spaces and any extra characters between number and unit","Ensure the value is non-negative","Verify the config key's expected minimum unit — accepted units start from the min unit and go up"],"exampleFix":"# before\ndisk_usage_percent_warning_threshold: 20 gb\n# after\ndisk_usage_percent_warning_threshold: 20GiB","handlingStrategy":"validation","validationCode":"java.util.regex.Pattern STORAGE = java.util.regex.Pattern.compile(\"^\\\\d+\\\\s*(B|KiB|MiB|GiB|TiB)$\");\nif (!STORAGE.matcher(cfgValue).matches())\n    throw new IllegalArgumentException(\"Storage must be <n><unit> with binary units, got: \" + cfgValue);","typeGuard":null,"tryCatchPattern":"try {\n    spec = DataStorageSpec.parseYamlType(value);\n} catch (IllegalArgumentException e) {\n    logger.error(\"Invalid data storage value: \" + value, e);\n    throw new ConfigurationException(\"Use e.g. 10GiB with accepted binary units\", e);\n}","preventionTips":["Use binary units with exact case: B, KiB, MiB, GiB, TiB","No spaces or trailing text between number and unit","Keep values non-negative and free of inline comments on the value"],"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"}