{"record":{"id":"e377d208f414dcb4","repo":"apache/cassandra","slug":"s-s-must-be-between-0-and-1","errorCode":null,"errorMessage":"%s %s must be between 0 and 1","messagePattern":"(.+?) (.+?) must be between 0 and 1","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/unified/Controller.java","lineNumber":655,"sourceCode":"            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a valid size in bytes for %s\",\n                                                               s,\n                                                               MIN_SSTABLE_SIZE_OPTION),\n                                                 e);\n            }\n        }\n\n        s = options.remove(SSTABLE_GROWTH_OPTION);\n        if (s != null)\n        {\n            try\n            {\n                double targetSSTableGrowth  = FBUtilities.parsePercent(s);\n                if (targetSSTableGrowth < 0 || targetSSTableGrowth > 1)\n                {\n                    throw new ConfigurationException(String.format(\"%s %s must be between 0 and 1\",\n                                                                   SSTABLE_GROWTH_OPTION,\n                                                                   s));\n                }\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a valid number between 0 and 1: %s\",\n                                                               SSTABLE_GROWTH_OPTION,\n                                                               e.getMessage()),\n                                                 e);\n            }\n        }\n\n        return options;\n    }\n\n    private static void validateBoolean(Map<String, String> options, String option)\n    {","sourceCodeStart":637,"sourceCodeEnd":673,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/unified/Controller.java#L637-L673","documentation":"The unified compaction controller validates the 'sstable_growth' option, which must be a percentage between 0 and 1 (inclusive). FBUtilities.parsePercent accepts forms like '0.5' or '50%'. If the parsed value falls outside [0,1], a ConfigurationException names the option and the offending value.","triggerScenarios":"Calling validateOptions with an sstable_growth option that parses (e.g. '1.5', '150%', '-0.2') but is numerically outside the 0..1 range.","commonSituations":"Users expressing a growth factor as a percentage number like '150' or '1.5' thinking it means 150%, or negative values from templating mistakes.","solutions":["Provide sstable_growth as a fraction between 0 and 1, e.g. '0.5' or '50%'.","Remove the option to use the default value.","Remember parsePercent accepts a trailing '%', so '50%' is valid but '150%' is not."],"exampleFix":"// before\ncompaction = {'class': 'UnifiedCompactionStrategy', 'sstable_growth': '150%'};\n// after\ncompaction = {'class': 'UnifiedCompactionStrategy', 'sstable_growth': '50%'};","handlingStrategy":"validation","validationCode":"String v = options.get(\"sstable_growth\");\nif (v != null) {\n    double d = v.endsWith(\"%\") ? Double.parseDouble(v.substring(0, v.length()-1)) / 100.0 : Double.parseDouble(v);\n    if (d < 0 || d > 1) throw new IllegalArgumentException(\"sstable_growth must be in [0,1]: \" + v);\n}","typeGuard":null,"tryCatchPattern":"try { strategy.validateOptions(opts); } catch (ConfigurationException e) { logger.error(\"Bad sstable_growth: {}\", e.getMessage()); }","preventionTips":["Express growth as a fraction (0.3) or percent string (30%), never a bare 30/150","Validate percent ranges in config templating pipelines","Keep a schema of allowed UCS options with ranges"],"tags":["cassandra","configuration","compaction","range"],"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-14T16:17:12.679Z"}