apache/cassandra · error · ConfigurationException
sstable_size_in_mb= is too large; resulting bytes exceed…
Error message
sstable_size_in_mb=%d is too large; resulting bytes exceed Long.MAX_VALUE (%d)
What it means
When computing maxSSTableSizeInBytes = ssSize * 1024 * 1024 with Math.multiplyExact, an oversized sstable_size_in_mb overflows a long and throws ArithmeticException, which LCS converts to this ConfigurationException indicating the configured sstable size exceeds what can be represented.
Solutions
- Set sstable_size_in_mb to a realistic positive value well below the overflow threshold (e.g. 160)
- ALTER the table with corrected options
- Bound-check generated values before applying schema changes
Example fix
// before
{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'99999999999999'}
// after
{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'160'} Defensive patterns
Strategy: validation
Validate before calling
long ssSize = Long.parseLong(opts.getOrDefault("sstable_size_in_mb", "160"));
if (ssSize > Long.MAX_VALUE / (1024L * 1024L)) throw new IllegalArgumentException("sstable_size_in_mb too large: " + ssSize); Try / catch
try { execute(alterStmt); }
catch (ConfigurationException e) { if (e.getMessage().contains("exceed Long.MAX_VALUE")) { /* reset sstable_size_in_mb to sane value */ } else throw e; } Prevention
- Bound-check numeric config values from automation
- Reject sstable_size_in_mb above a sane ceiling (e.g. 1_000_000) in tooling
- Review generated CQL diffs for digit corruption
When it happens
Trigger: sstable_size_in_mb greater than Long.MAX_VALUE/1048576 (about 8.8e12 MB) supplied in compaction options.
Common situations: Fat-fingered config values with many extra digits; automated config generation bugs multiplying values.
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
- At most bytes may be in a compaction level; your…
- 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/d00dbd6e7ace362b.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java:641
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)