apache/cassandra · error · ConfigurationException

%s %s must be between 0 and 1

Error message

%s %s must be between 0 and 1

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/db/compaction/unified/Controller.java:655

            }
            catch (NumberFormatException e)
            {
                throw new ConfigurationException(String.format("%s is not a valid size in bytes for %s",
                                                               s,
                                                               MIN_SSTABLE_SIZE_OPTION),
                                                 e);
            }
        }

        s = options.remove(SSTABLE_GROWTH_OPTION);
        if (s != null)
        {
            try
            {
                double targetSSTableGrowth  = FBUtilities.parsePercent(s);
                if (targetSSTableGrowth < 0 || targetSSTableGrowth > 1)
                {
                    throw new ConfigurationException(String.format("%s %s must be between 0 and 1",
                                                                   SSTABLE_GROWTH_OPTION,
                                                                   s));
                }
            }
            catch (NumberFormatException e)
            {
                throw new ConfigurationException(String.format("%s is not a valid number between 0 and 1: %s",
                                                               SSTABLE_GROWTH_OPTION,
                                                               e.getMessage()),
                                                 e);
            }
        }

        return options;
    }

    private static void validateBoolean(Map<String, String> options, String option)
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Provide sstable_growth as a fraction between 0 and 1, e.g. '0.5' or '50%'.
  2. Remove the option to use the default value.
  3. Remember parsePercent accepts a trailing '%', so '50%' is valid but '150%' is not.

Example fix

// before
compaction = {'class': 'UnifiedCompactionStrategy', 'sstable_growth': '150%'};
// after
compaction = {'class': 'UnifiedCompactionStrategy', 'sstable_growth': '50%'};
Defensive patterns

Strategy: validation

Validate before calling

String v = options.get("sstable_growth");
if (v != null) {
    double d = v.endsWith("%") ? Double.parseDouble(v.substring(0, v.length()-1)) / 100.0 : Double.parseDouble(v);
    if (d < 0 || d > 1) throw new IllegalArgumentException("sstable_growth must be in [0,1]: " + v);
}

Try / catch

try { strategy.validateOptions(opts); } catch (ConfigurationException e) { logger.error("Bad sstable_growth: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling validateOptions with an sstable_growth option that parses (e.g. '1.5', '150%', '-0.2') but is numerically outside the 0..1 range.

Common situations: Users expressing a growth factor as a percentage number like '150' or '1.5' thinking it means 150%, or negative values from templating mistakes.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/e377d208f414dcb4. Report an issue: GitHub.