apache/cassandra · error · ConfigurationException
%s must be non negative: %d
Error message
%s must be non negative: %d
What it means
ConfigurationException thrown by SizeTieredCompactionStrategyOptions.validateOptions when the min_sstable_size option parses as a valid long but is negative. Minimum SSTable size for size-tiered bucketing must be >= 0, so a negative value is rejected before the strategy is instantiated.
Source
Thrown at src/java/org/apache/cassandra/db/compaction/SizeTieredCompactionStrategyOptions.java:75
try
{
return optionValue == null ? defaultValue : Double.parseDouble(optionValue);
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("%s is not a parsable float for %s", optionValue, key), e);
}
}
public static Map<String, String> validateOptions(Map<String, String> options, Map<String, String> uncheckedOptions) throws ConfigurationException
{
String optionValue = options.get(MIN_SSTABLE_SIZE_KEY);
try
{
long minSSTableSize = optionValue == null ? DEFAULT_MIN_SSTABLE_SIZE : Long.parseLong(optionValue);
if (minSSTableSize < 0)
{
throw new ConfigurationException(String.format("%s must be non negative: %d", MIN_SSTABLE_SIZE_KEY, minSSTableSize));
}
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", optionValue, MIN_SSTABLE_SIZE_KEY), e);
}
double bucketLow = parseDouble(options, BUCKET_LOW_KEY, DEFAULT_BUCKET_LOW);
double bucketHigh = parseDouble(options, BUCKET_HIGH_KEY, DEFAULT_BUCKET_HIGH);
if (bucketHigh <= bucketLow)
{
throw new ConfigurationException(String.format("%s value (%s) is less than or equal to the %s value (%s)",
BUCKET_HIGH_KEY, bucketHigh, BUCKET_LOW_KEY, bucketLow));
}
uncheckedOptions.remove(MIN_SSTABLE_SIZE_KEY);
uncheckedOptions.remove(BUCKET_LOW_KEY);
uncheckedOptions.remove(BUCKET_HIGH_KEY);View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set min_sstable_size to a non-negative byte value (e.g. '52428800' for 50MB) or remove it to use the default (50MB).
- Re-run ALTER TABLE with the corrected compaction map.
- Add caller-side validation rejecting negative byte sizes before applying schema options.
Example fix
// before
{'class':'SizeTieredCompactionStrategy','min_sstable_size':'-1024'}
// after
{'class':'SizeTieredCompactionStrategy','min_sstable_size':'52428800'} Defensive patterns
Strategy: validation
Validate before calling
long minSstableSize = Long.parseLong(opts.getOrDefault("min_sstable_size", "52428800"));
if (minSstableSize < 0) throw new IllegalArgumentException("min_sstable_size must be >= 0"); Try / catch
try { schema.alterTable(cql); } catch (ConfigurationException e) { if (e.getMessage().contains("must be non negative")) { /* fix the option and retry */ } else throw e; } Prevention
- Never emit negative byte sizes; clamp with Math.max(0, size).
- Sanitize option values for stray '-' signs before building the compaction map.
- Keep sizes as plain decimal byte strings in templates.
When it happens
Trigger: CREATE/ALTER TABLE with compaction option {'min_sstable_size': '-1024'} — any value < 0 supplied for min_sstable_size on SizeTieredCompactionStrategy.
Common situations: Hand-edited schema options where a '-' was typed accidentally; a sizing tool writing negative bytes after a failed computation; copy-paste of a value intended for another option.
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
- %s must be greater than 0, but was %f
- %s is not a parsable int (base10) for %s
- %s value (%s) is less than or equal to the %s value (%s)
- Fan factor cannot be lower than 2 in %s
- %s %s is not acceptable, size must be at least %s
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/051dbfd85bea7571.
Report an issue: GitHub.