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

The NumberFormatException catch branch for base_shard_count in Controller.validateOptions: when the option value is not a base-10 parsable int, ConfigurationException is thrown with the raw string and the option name, chained to the parse exception.

Source

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

        s = options.remove(SCALING_PARAMETERS_OPTION);
        if (s != null)
            parseScalingParameters(s);

        s = options.remove(BASE_SHARD_COUNT_OPTION);
        if (s != null)
        {
            try
            {
                int numShards = Integer.parseInt(s);
                if (numShards <= 0)
                    throw new ConfigurationException(String.format("Invalid configuration, %s should be positive: %d",
                                                                   BASE_SHARD_COUNT_OPTION,
                                                                   numShards));
            }
            catch (NumberFormatException e)
            {
                throw new ConfigurationException(String.format("%s is not a parsable int (base10) for %s",
                                                               s,
                                                               BASE_SHARD_COUNT_OPTION), e);
            }
        }

        // preserve the configuration for later use during min_sstable_size.
        long targetSSTableSize = DEFAULT_TARGET_SSTABLE_SIZE;
        s = options.remove(TARGET_SSTABLE_SIZE_OPTION);
        if (s != null)
        {
            try
            {
                double targetSize = FBUtilities.parseHumanReadable(s, null, "B");
                if (targetSize >= Long.MAX_VALUE) {
                    throw new ConfigurationException(String.format("%s %s is out of range of Long.",
                                                                    TARGET_SSTABLE_SIZE_OPTION,
                                                                    s));
                }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Set base_shard_count to a plain base-10 integer string, e.g. '4'
  2. Sanitize generated configs to emit integers without decimals/units/whitespace
  3. Remove the option to use the default
  4. Catch ConfigurationException around schema changes for clear feedback

Example fix

// before
'base_shard_count': '4.0'
// after
'base_shard_count': '4'
Defensive patterns

Strategy: validation

Validate before calling

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

Type guard

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

Try / catch

try {
    session.execute(alterStmt);
} catch (RuntimeException e) {
    if (e.getMessage().contains("is not a parsable int") && e.getMessage().contains("base_shard_count")) { /* fix value */ }
    throw e;
}

Prevention

When it happens

Trigger: validateOptions with base_shard_count set to 'four', '4.0', '', ' 4', or a value above Integer.MAX_VALUE.

Common situations: Decimal values from JSON templating; accidental units ('4 shards'); whitespace or quotes leaking into the value; large numbers exceeding int range.

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