apache/cassandra · error · ConfigurationException

%s is not a parsable int (base10) for %s

Error message

%s is not a parsable int (base10) for %s

What it means

TimeWindowCompactionStrategy (TWCS) throws this ConfigurationException when the compaction_window_size option cannot be parsed as a base-10 integer. It is raised inside validateOptions, which runs whenever a table is created/altered with TWCS or its options are validated, so a bad value fails fast at schema time rather than at compaction time.

Source

Thrown at src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java:133

        }
        catch (IllegalArgumentException e)
        {
            throw new ConfigurationException(String.format("%s is not valid for %s", optionValue, COMPACTION_WINDOW_UNIT_KEY), e);
        }

        optionValue = options.get(COMPACTION_WINDOW_SIZE_KEY);
        try
        {
            int sstableWindowSize = optionValue == null ? DEFAULT_COMPACTION_WINDOW_SIZE : Integer.parseInt(optionValue);
            if (sstableWindowSize < 1)
            {
                throw new ConfigurationException(String.format("%d must be greater than 1 for %s", sstableWindowSize, COMPACTION_WINDOW_SIZE_KEY));
            }
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", optionValue, COMPACTION_WINDOW_SIZE_KEY), e);
        }

        optionValue = options.get(EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY);
        try
        {
            long expiredCheckFrequency = optionValue == null ? DEFAULT_EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS : Long.parseLong(optionValue);
            if (expiredCheckFrequency < 0)
            {
                throw new ConfigurationException(String.format("%s must not be negative, but was %d", EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY, expiredCheckFrequency));
             }
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s", optionValue, EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY), e);
        }


        optionValue = options.get(UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_KEY);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set compaction_window_size to a plain base-10 integer string, e.g. '1'
  2. Remove unit suffixes or decimals from the value; units go in compaction_window_unit
  3. Quote the option value correctly in CQL so no stray whitespace is included
  4. Catch org.apache.cassandra.exceptions.ConfigurationException around the schema change to surface a friendlier message

Example fix

// before
ALTER TABLE ks.t WITH compaction = {'class':'TimeWindowCompactionStrategy','compaction_window_size':'1d','compaction_window_unit':'DAYS'};
// after
ALTER TABLE ks.t WITH compaction = {'class':'TimeWindowCompactionStrategy','compaction_window_size':'1','compaction_window_unit':'DAYS'};
Defensive patterns

Strategy: validation

Validate before calling

if (opts.containsKey("compaction_window_size") && !opts.get("compaction_window_size").trim().matches("\\d+"))
    throw new IllegalArgumentException("compaction_window_size must be a plain base-10 integer");

Type guard

static boolean isPlainInt(String s) { if (s == null) return false; try { Integer.parseInt(s.trim()); return true; } catch (NumberFormatException e) { return false; } }

Try / catch

try {
    session.execute("ALTER TABLE ks.t WITH compaction = {...}");
} catch (com.datastax.driver.core.exceptions.InvalidQueryException e) {
    // driver surfaces server ConfigurationException as InvalidQueryException; check message for compaction_window_size
}

Prevention

When it happens

Trigger: Calling validateOptions (via CREATE/ALTER TABLE ... WITH compaction = {'class':'TimeWindowCompactionStrategy','compaction_window_size':'...'}) with a compaction_window_size value that Integer.parseInt rejects, e.g. 'ten', '1.5', '10s', '', or a number too large for int.

Common situations: Typing the size with a unit suffix (e.g. '60m' or '1d'); copy-paste errors leaving whitespace; using a decimal like '1.5'; tools or IaC templates generating non-numeric defaults.

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/6f68c917c90247f0. Report an issue: GitHub.