apache/cassandra · error · IllegalArgumentException
Invalid data storage: ${value} Accepted units:${acceptedUnit
Error message
Invalid data storage: ${value} Accepted units:${acceptedUnits(minUnit)} where case matters and only non-negative values are accepted What it means
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.
Source
Thrown at src/java/org/apache/cassandra/config/DataStorageSpec.java:73
validateMinUnit(unit, minUnit, value);
validateQuantity(quantity, unit, minUnit, max);
}
private DataStorageSpec(String value, DataStorageUnit minUnit)
{
//parse the string field value
Matcher matcher = UNITS_PATTERN.matcher(value);
if (matcher.find())
{
quantity = Long.parseLong(matcher.group(1));
unit = DataStorageUnit.fromSymbol(matcher.group(2));
// this constructor is used only by extended classes for min unit; upper bound and min unit are guarded there accordingly
}
else
{
throw new IllegalArgumentException("Invalid data storage: " + value + " Accepted units:" + acceptedUnits(minUnit) +
" where case matters and only non-negative values are accepted");
}
}
private DataStorageSpec(String value, DataStorageUnit minUnit, long max)
{
this(value, minUnit);
validateMinUnit(unit, minUnit, value);
validateQuantity(value, quantity(), unit(), minUnit, max);
}
private static void validateMinUnit(DataStorageUnit sourceUnit, DataStorageUnit minUnit, String value)
{
if (sourceUnit.compareTo(minUnit) < 0)
throw new IllegalArgumentException(String.format("Invalid data storage: %s Accepted units:%s", value, acceptedUnits(minUnit)));
}
View on GitHub (pinned to 88fd0f6a0e)
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
Example fix
# before disk_usage_percent_warning_threshold: 20 gb # after disk_usage_percent_warning_threshold: 20GiB
Defensive patterns
Strategy: validation
Validate before calling
java.util.regex.Pattern STORAGE = java.util.regex.Pattern.compile("^\\d+\\s*(B|KiB|MiB|GiB|TiB)$");
if (!STORAGE.matcher(cfgValue).matches())
throw new IllegalArgumentException("Storage must be <n><unit> with binary units, got: " + cfgValue); Try / catch
try {
spec = DataStorageSpec.parseYamlType(value);
} catch (IllegalArgumentException e) {
logger.error("Invalid data storage value: " + value, e);
throw new ConfigurationException("Use e.g. 10GiB with accepted binary units", e);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid data rate: ${value} Accepted units: MiB/s, KiB/s, B/
- Invalid data rate: ${value}. It shouldn't be more than ${max
- Unsupported data rate unit: %s. Supported units are: %s
- Invalid data storage: %s Accepted units:%s
- data_file_directories must not contain empty entry
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/8a54dca4aa647045.
Report an issue: GitHub.