{"record":{"id":"444395b034b3ddc8","repo":"apache/cassandra","slug":"s-must-be-larger-than-0-but-was-s","errorCode":null,"errorMessage":"%s must be larger than 0, but was %s","messagePattern":"(.+?) must be larger than 0, but was (.+?)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java","lineNumber":603,"sourceCode":"            }\n        };\n    }\n\n    public static Map<String, String> validateOptions(Map<String, String> options) throws ConfigurationException\n    {\n        Map<String, String> uncheckedOptions = AbstractCompactionStrategy.validateOptions(options);\n\n        int ssSize;\n        int fanoutSize;\n\n        // Validate the sstable_size option\n        String size = options.containsKey(SSTABLE_SIZE_OPTION) ? options.get(SSTABLE_SIZE_OPTION) : String.valueOf(DEFAULT_MAX_SSTABLE_SIZE_MIB);\n        try\n        {\n            ssSize = Integer.parseInt(size);\n            if (ssSize < 1)\n            {\n                throw new ConfigurationException(String.format(\"%s must be larger than 0, but was %s\", SSTABLE_SIZE_OPTION, ssSize));\n            }\n        }\n        catch (NumberFormatException ex)\n        {\n            throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", size, SSTABLE_SIZE_OPTION), ex);\n        }\n\n        uncheckedOptions.remove(SSTABLE_SIZE_OPTION);\n\n        // Validate the fanout_size option\n        String levelFanoutSize = options.containsKey(LEVEL_FANOUT_SIZE_OPTION) ? options.get(LEVEL_FANOUT_SIZE_OPTION) : String.valueOf(DEFAULT_LEVEL_FANOUT_SIZE);\n        try\n        {\n            fanoutSize = Integer.parseInt(levelFanoutSize);\n            if (fanoutSize < 1)\n            {\n                throw new ConfigurationException(String.format(\"%s must be larger than 0, but was %s\", LEVEL_FANOUT_SIZE_OPTION, fanoutSize));\n            }","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/LeveledCompactionStrategy.java#L585-L621","documentation":"LeveledCompactionStrategy validates its sstable_size_in_mb option at strategy construction. If the provided value parses as an integer but is less than 1, a ConfigurationException with this message is thrown, preventing the strategy (and typically the table creation/ALTER) from being applied.","triggerScenarios":"CREATE/ALTER TABLE ... WITH compaction = {'class':'LeveledCompactionStrategy','sstable_size_in_mb':'0'} (or a negative number), or the option set programmatically via CompactionParams with a non-positive value.","commonSituations":"Typos in CQL compaction options such as 0 or -1; scripts generating options with an unset variable; copying config from a cluster using a different unit convention.","solutions":["Set sstable_size_in_mb to a positive integer (commonly 160, the default)","ALTER the table with corrected options: ALTER TABLE ks.t WITH compaction = {'class':'LeveledCompactionStrategy','sstable_size_in_mb':'160'};","Validate option values before applying them in automation that edits schema"],"exampleFix":"// before\n{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'0'}\n// after\n{'class':'LeveledCompactionStrategy','sstable_size_in_mb':'160'}","handlingStrategy":"validation","validationCode":"int v = Integer.parseInt(opts.getOrDefault(\"sstable_size_in_mb\", \"160\"));\nif (v < 1) throw new IllegalArgumentException(\"sstable_size_in_mb must be >= 1\");","typeGuard":null,"tryCatchPattern":"try { execute(\"ALTER TABLE ks.t WITH compaction = \" + opts); }\ncatch (ConfigurationException e) { /* fix option values reported in message */ }","preventionTips":["Validate compaction option maps against documented ranges before schema writes","Never emit 0/negative defaults from tooling","Copy known-good option sets when cloning table schemas"],"tags":["compaction","configuration","leveled"],"backgroundTag":"invalid-config-value","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"}