apache/cassandra · error · ConfigurationException
At most bytes may be in a compaction level; your…
Error message
At most %s bytes may be in a compaction level; your maxSSTableSize must be absurdly high to compute %s
What it means
LCS computes the maximum bytes in a level as fanoutSize^(MAX_LEVEL_COUNT-1) * maxSSTableSizeInBytes using BigInteger to avoid silent overflow. If this exceeds Long.MAX_VALUE, the strategy cannot represent level sizes and throws this ConfigurationException, telling the user their maxSSTableSize/fanout combination is absurdly large.
Solutions
- Reduce sstable_size_in_mb to a sane value (e.g. 160) and/or keep level_fanout_size at the default 10
- ALTER the table with realistic options and re-check
- Compute fanout^9 * size_in_bytes offline to verify it fits in a signed 64-bit long before applying
Example fix
// before
{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'10000000','level_fanout_size':'50'}
// after
{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'160','level_fanout_size':'10'} Defensive patterns
Strategy: validation
Validate before calling
long ssSize = Long.parseLong(opts.getOrDefault("sstable_size_in_mb", "160"));
int fanout = Integer.parseInt(opts.getOrDefault("level_fanout_size", "10"));
if (BigInteger.valueOf(fanout).pow(8).multiply(BigInteger.valueOf(ssSize).multiply(BigInteger.valueOf(1L<<20))).compareTo(BigInteger.valueOf(Long.MAX_VALUE)) > 0)
throw new IllegalArgumentException("fanout^9 * sstable bytes exceeds Long.MAX_VALUE"); Try / catch
try { execute(alterStmt); }
catch (ConfigurationException e) { if (e.getMessage().startsWith("At most")) { /* shrink sstable_size_in_mb or fanout */ } else throw e; } Prevention
- Compute fanout^(9) * sstableBytes offline before applying extreme tuning
- Cap sstable_size_in_mb and level_fanout_size in tooling
- Keep LCS options near defaults unless profiling justifies otherwise
When it happens
Trigger: Very large sstable_size_in_mb combined with a large level_fanout_size such that fanout^9 * sstableBytes > 2^63-1 during CREATE/ALTER TABLE or strategy construction.
Common situations: Copy-paste of extreme tuning values (e.g. sstable_size_in_mb of millions); accidental extra digits in config automation.
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
- sstable_size_in_mb= is too large; resulting bytes exceed…
- Cannot set concurrent_validations greater than…
- compaction_throughput: is too large; it should be less than…
- concurrent_compactors should be strictly greater than 0…
- Could not set new local compaction strategy
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/970f6f921df4ab65.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java:636
if (fanoutSize < 1)
{
throw new ConfigurationException(String.format("%s must be larger than 0, but was %s", LEVEL_FANOUT_SIZE_OPTION, fanoutSize));
}
}
catch (NumberFormatException ex)
{
throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", levelFanoutSize, LEVEL_FANOUT_SIZE_OPTION), ex);
}
// Validate max Bytes for a level
try
{
long maxSSTableSizeInBytes = Math.multiplyExact(ssSize, 1024L * 1024L); // Convert MB to Bytes
BigInteger fanoutPower = BigInteger.valueOf(fanoutSize).pow(MAX_LEVEL_COUNT - 1);
BigInteger maxBytes = fanoutPower.multiply(BigInteger.valueOf(maxSSTableSizeInBytes));
BigInteger longMaxValue = BigInteger.valueOf(Long.MAX_VALUE);
if (maxBytes.compareTo(longMaxValue) > 0)
throw new ConfigurationException(String.format("At most %s bytes may be in a compaction level; " +
"your maxSSTableSize must be absurdly high to compute %s", Long.MAX_VALUE, maxBytes));
}
catch (ArithmeticException ex)
{
throw new ConfigurationException(String.format("sstable_size_in_mb=%d is too large; resulting bytes exceed Long.MAX_VALUE (%d)", ssSize, Long.MAX_VALUE), ex);
}
uncheckedOptions.remove(LEVEL_FANOUT_SIZE_OPTION);
uncheckedOptions.remove(SINGLE_SSTABLE_UPLEVEL_OPTION);
uncheckedOptions.remove(CompactionParams.Option.MIN_THRESHOLD.toString());
uncheckedOptions.remove(CompactionParams.Option.MAX_THRESHOLD.toString());
uncheckedOptions = SizeTieredCompactionStrategyOptions.validateOptions(options, uncheckedOptions);
return uncheckedOptions;
}
}View on GitHub (pinned to 88fd0f6a0e)