apache/cassandra · error · ConfigurationException
%s must be greater than 0, but was %f
Error message
%s must be greater than 0, but was %f
What it means
AbstractCompactionStrategy.validateOptions checks the tombstone_threshold option: the parsed float must be >= 0. A negative value throws ConfigurationException '%s must be greater than 0, but was %f'. Note the check rejects only negative values (0 passes despite the message wording).
Source
Thrown at src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java:461
long columns = sstable.getEstimatedCellPerPartitionCount().mean() * remainingKeys;
double remainingColumnsRatio = ((double) columns) / (sstable.getEstimatedCellPerPartitionCount().count() * sstable.getEstimatedCellPerPartitionCount().mean());
// return if we still expect to have droppable tombstones in rest of columns
return remainingColumnsRatio * droppableRatio > tombstoneThreshold;
}
}
public static Map<String, String> validateOptions(Map<String, String> options) throws ConfigurationException
{
String threshold = options.get(TOMBSTONE_THRESHOLD_OPTION);
if (threshold != null)
{
try
{
float thresholdValue = Float.parseFloat(threshold);
if (thresholdValue < 0)
{
throw new ConfigurationException(String.format("%s must be greater than 0, but was %f", TOMBSTONE_THRESHOLD_OPTION, thresholdValue));
}
}
catch (NumberFormatException e)
{
throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", threshold, TOMBSTONE_THRESHOLD_OPTION), e);
}
}
String interval = options.get(TOMBSTONE_COMPACTION_INTERVAL_OPTION);
if (interval != null)
{
try
{
long tombstoneCompactionInterval = Long.parseLong(interval);
if (tombstoneCompactionInterval < 0)
{
throw new ConfigurationException(String.format("%s must be greater than 0, but was %d", TOMBSTONE_COMPACTION_INTERVAL_OPTION, tombstoneCompactionInterval));
}View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set tombstone_threshold to a non-negative float between 0 and 1 (it is a ratio of garbage tombstones), e.g. 0.2.
- Re-run the ALTER TABLE / nodetool table compaction option update with the corrected value.
- If you meant a time-based trigger, use tombstone_compaction_interval instead.
- Validate options programmatically via compaction strategy validateOptions before applying.
Example fix
// before
ALTER TABLE ks.tbl WITH compaction = {'class': 'SizeTieredCompactionStrategy', 'tombstone_threshold': '-0.5'};
// after
ALTER TABLE ks.tbl WITH compaction = {'class': 'SizeTieredCompactionStrategy', 'tombstone_threshold': '0.2'}; Defensive patterns
Strategy: validation
Validate before calling
float v = Float.parseFloat(opts.getOrDefault("tombstone_threshold", "0.2"));
if (v < 0 || v > 1)
throw new ConfigurationException("tombstone_threshold must be a ratio in [0,1]"); Try / catch
try {
strategy.validateOptions(options);
} catch (ConfigurationException e) {
logger.error("Invalid compaction option: {}", e.getMessage());
} Prevention
- Remember tombstone_threshold is a ratio (0..1), not a time or byte count
- Validate compaction options with validateOptions before ALTER TABLE
- Use tombstone_compaction_interval for time-based tombstone checks
When it happens
Trigger: ALTER TABLE ... WITH compaction = {'class': '...', 'tombstone_threshold': '-0.1'} or supplying the option in cassandra.yaml/compaction options with a negative float.
Common situations: Sign typo in schema definition; copy-pasted negative values from ratio-style options; scripting that computes a negative threshold; confusion between tombstone_threshold (ratio) and tombstone_compaction_interval (seconds).
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 is not a parsable int (base10) for %s
- %s must be non negative: %d
- %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/e1cb77a1e04d446a.
Report an issue: GitHub.