apache/cassandra · error · ConfigurationException
Min compaction threshold
Error message
Min compaction threshold (got %d) cannot be greater than max compaction threshold (got %d)
What it means
Fired in CompactionParams.validate (reached via ALTER TABLE ... WITH compaction or table creation options): min_compaction_threshold exceeds max_compaction_threshold, an invalid combination since min must be <= max (and both positive). Thrown as ConfigurationException during compaction option validation.
Solutions
- Set max_threshold >= min_threshold, e.g. {'min_threshold': '4', 'max_threshold': '32'}
- Re-check which value is which; the values are often accidentally swapped
- Add pre-submission validation: reject any option map where min > max
Example fix
// before
compaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '32', 'max_threshold': '4'}
// after
compaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '4', 'max_threshold': '32'} Defensive patterns
Strategy: validation
Validate before calling
int min = Integer.parseInt(opts.getOrDefault("min_threshold", "4"));
int max = Integer.parseInt(opts.getOrDefault("max_threshold", "32"));
if (min > max) throw new IllegalArgumentException("min_threshold must be <= max_threshold"); Try / catch
try { schemaChange(ddl); } catch (ConfigurationException e) { if (e.getMessage().contains("cannot be greater than max")) { /* swap/correct thresholds */ } throw e; } Prevention
- Always set min and max thresholds together with min <= max
- Add a sanity assertion wherever thresholds are computed programmatically
- Avoid independent config keys that can drift apart
When it happens
Trigger: Schema changes like {'min_threshold': '32', 'max_threshold': '4'}; programmatic option maps where the values are swapped or computed independently without cross-checking.
Common situations: Bulk schema edits that set one threshold but forget the other; automation that computes thresholds from metrics without sanity checks.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- concurrent_compactors should be strictly greater than 0…
- Could not set new local compaction strategy
- Disabling compaction by setting compaction thresholds to 0…
- Fan factor cannot be lower than 2 in
- Invalid configuration
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/3ec06a814f0a84bc.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/schema/CompactionParams.java:260
maxThreshold,
Option.MAX_THRESHOLD));
}
if (minCompactionThreshold() <= 0 || maxCompactionThreshold() <= 0)
{
throw new ConfigurationException("Disabling compaction by setting compaction thresholds to 0 has been removed,"
+ " set the compaction option 'enabled' to false instead.");
}
if (minCompactionThreshold() <= 1)
{
throw new ConfigurationException(format("Min compaction threshold cannot be less than 2 (got %d)",
minCompactionThreshold()));
}
if (minCompactionThreshold() > maxCompactionThreshold())
{
throw new ConfigurationException(format("Min compaction threshold (got %d) cannot be greater than max compaction threshold (got %d)",
minCompactionThreshold(),
maxCompactionThreshold()));
}
}
double defaultBloomFilterFbChance()
{
return klass.equals(LeveledCompactionStrategy.class) ? 0.1 : 0.01;
}
public Class<? extends AbstractCompactionStrategy> klass()
{
return klass;
}
/**
* All strategy options - excluding 'class'.
*/View on GitHub (pinned to 88fd0f6a0e)