{"record":{"id":"d00dbd6e7ace362b","repo":"apache/cassandra","slug":"sstable-size-in-mb-d-is-too-large-resulting-byte","errorCode":null,"errorMessage":"sstable_size_in_mb=%d is too large; resulting bytes exceed Long.MAX_VALUE (%d)","messagePattern":"sstable_size_in_mb=(.+?) is too large; resulting bytes exceed Long\\.MAX_VALUE \\((.+?)\\)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java","lineNumber":641,"sourceCode":"        catch (NumberFormatException ex)\n        {\n            throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", levelFanoutSize, LEVEL_FANOUT_SIZE_OPTION), ex);\n        }\n\n        // Validate max Bytes for a level\n        try\n        {\n            long maxSSTableSizeInBytes = Math.multiplyExact(ssSize, 1024L * 1024L); // Convert MB to Bytes\n            BigInteger fanoutPower = BigInteger.valueOf(fanoutSize).pow(MAX_LEVEL_COUNT - 1);\n            BigInteger maxBytes = fanoutPower.multiply(BigInteger.valueOf(maxSSTableSizeInBytes));\n            BigInteger longMaxValue = BigInteger.valueOf(Long.MAX_VALUE);\n            if (maxBytes.compareTo(longMaxValue) > 0)\n                throw new ConfigurationException(String.format(\"At most %s bytes may be in a compaction level; \" +\n                        \"your maxSSTableSize must be absurdly high to compute %s\", Long.MAX_VALUE, maxBytes));\n        }\n        catch (ArithmeticException ex)\n        {\n            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);\n        }\n\n        uncheckedOptions.remove(LEVEL_FANOUT_SIZE_OPTION);\n        uncheckedOptions.remove(SINGLE_SSTABLE_UPLEVEL_OPTION);\n\n        uncheckedOptions.remove(CompactionParams.Option.MIN_THRESHOLD.toString());\n        uncheckedOptions.remove(CompactionParams.Option.MAX_THRESHOLD.toString());\n\n        uncheckedOptions = SizeTieredCompactionStrategyOptions.validateOptions(options, uncheckedOptions);\n\n        return uncheckedOptions;\n    }\n}\n","sourceCodeStart":623,"sourceCodeEnd":655,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java#L623-L655","documentation":"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.","triggerScenarios":"sstable_size_in_mb greater than Long.MAX_VALUE/1048576 (about 8.8e12 MB) supplied in compaction options.","commonSituations":"Fat-fingered config values with many extra digits; automated config generation bugs multiplying values.","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"],"exampleFix":"// before\n{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'99999999999999'}\n// after\n{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'160'}","handlingStrategy":"validation","validationCode":"long ssSize = Long.parseLong(opts.getOrDefault(\"sstable_size_in_mb\", \"160\"));\nif (ssSize > Long.MAX_VALUE / (1024L * 1024L)) throw new IllegalArgumentException(\"sstable_size_in_mb too large: \" + ssSize);","typeGuard":null,"tryCatchPattern":"try { execute(alterStmt); }\ncatch (ConfigurationException e) { if (e.getMessage().contains(\"exceed Long.MAX_VALUE\")) { /* reset sstable_size_in_mb to sane value */ } else throw e; }","preventionTips":["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"],"tags":["compaction","configuration","overflow"],"backgroundTag":"value-out-of-range","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}