apache/cassandra · error · ConfigurationException

is not a valid size in bytes for

Error message

%s is not a valid size in bytes for %s

What it means

Cassandra's unified compaction controller validates compaction options at configuration time. The 'min_sstable_size' option must be a byte size parseable by FBUtilities (e.g. '100MiB', '52428800'). When the string cannot be parsed as a number of bytes, a ConfigurationException wrapping the NumberFormatException is thrown so the user learns which option and which value failed.

Solutions

  1. Fix the min_sstable_size option to a valid size string like '50MiB' or a plain byte count like '52428800'.
  2. Omit the option entirely to use the controller's default value.
  3. Use FBUtilities.prettyPrintMemory-compatible units: B, KiB, MiB, GiB, TiB (binary units), not 'MB' style decimal units.
  4. Check the wrapped NumberFormatException message (the cause) to see exactly what failed to parse.

Example fix

// before
ALTER TABLE ks.tbl WITH compaction = {'class': 'UnifiedCompactionStrategy', 'min_sstable_size': '100 MB'};
// after
ALTER TABLE ks.tbl WITH compaction = {'class': 'UnifiedCompactionStrategy', 'min_sstable_size': '100MiB'};
Defensive patterns

Strategy: validation

Validate before calling

String v = options.get("min_sstable_size");
if (v != null) {
    try { FBUtilities.parseFileSize(v, false); }
    catch (Exception e) { throw new IllegalArgumentException("min_sstable_size must be a valid size like 50MiB: " + v); }
}

Try / catch

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

Prevention

When it happens

Trigger: Calling validateOptions (directly or via setting the compaction strategy options on a table, e.g. ALTER TABLE ... WITH compaction = {'class':'UnifiedCompactionStrategy','min_sstable_size':'abc'}) with a min_sstable_size value that is not a valid byte-size string.

Common situations: Typo in the size string ('100 MB' with bad unit, '100mib' misspelling, locale-specific decimal separators, plain garbage values), copy-pasted configs from other systems, or automations writing malformed YAML/option maps.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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

Appendix: source

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

        if (s != null)
        {
            try
            {
                long sizeInBytes = FBUtilities.parseHumanReadableBytes(s);
                // zero is a valid option to disable feature
                if (sizeInBytes < 0)
                    throw new ConfigurationException(String.format("Invalid configuration, %s should be greater than or equal to 0 (zero)",
                                                                   MIN_SSTABLE_SIZE_OPTION));
                long limit = (long) Math.ceil(targetSSTableSize * INVERSE_SQRT_2);
                if (sizeInBytes >= limit)
                    throw new ConfigurationException(String.format("Invalid configuration, %s (%s) should be less than 70%% of the targetSSTableSize (%s)",
                                                                   MIN_SSTABLE_SIZE_OPTION,
                                                                   FBUtilities.prettyPrintMemory(sizeInBytes),
                                                                   FBUtilities.prettyPrintMemory(targetSSTableSize)));
            }
            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));
                }

View on GitHub (pinned to 88fd0f6a0e)