apache/cassandra · error · ConfigurationException

consensus_migration_cache_size option was set incorrectly to

Error message

consensus_migration_cache_size option was set incorrectly to '<value>', supported values are <integer> >= 0.

What it means

Thrown when consensus_migration_cache_size in cassandra.yaml parses to a negative mebibyte value. applySimpleConfig explicitly throws NumberFormatException when the value is < 0 (to reuse the shared error message) and converts it into this ConfigurationException. The cache is used during the migration to Accord consensus, so a nonsensical size is rejected at startup.

Solutions

  1. Set consensus_migration_cache_size to a positive mebibyte value (e.g. 50MiB) or remove the key to use the default min(1% of heap, 50MB).
  2. Validate the yaml with a lint/check before restart.
  3. Restart the node after fixing.

Example fix

# before
consensus_migration_cache_size: -10MiB
# after
consensus_migration_cache_size: 50MiB
Defensive patterns

Strategy: validation

Validate before calling

Object v = yaml.get("consensus_migration_cache_size");
if (v != null && String.valueOf(v).trim().startsWith("-"))
    throw new IllegalArgumentException("consensus_migration_cache_size must be >= 0");

Type guard

boolean isValidCacheSize(Object v) {
    return v == null || (v instanceof Number && ((Number) v).longValue() >= 0);
}

Try / catch

try {
    DatabaseDescriptor.applySimpleConfig();
} catch (ConfigurationException e) {
    if (e.getMessage().contains("consensus_migration_cache_size"))
        logger.error("Set consensus_migration_cache_size to a positive MiB value or remove it: {}", e.getMessage());
}

Prevention

When it happens

Trigger: conf.consensus_migration_cache_size is set to a negative value in cassandra.yaml, e.g. 'consensus_migration_cache_size: -100MiB'; non-parsable values also land in this catch block.

Common situations: Sign typo when hand-editing yaml; templating accident producing negative numbers; misreading the option as a percentage rather than a storage bound.

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

Appendix: source

Thrown at src/java/org/apache/cassandra/config/DatabaseDescriptor.java:1090

        catch (NumberFormatException e)
        {
            throw new ConfigurationException("accord.working_set_size option was set incorrectly to '"
                                             + conf.accord.working_set_size + "', supported values are <integer> >= 0.", false);
        }

        try
        {
            // if consensusMigrationCacheSizeInMiB option was set to "auto" then size of the cache should be "min(1% of Heap (in MB), 50MB)
            consensusMigrationCacheSizeInMiB = (conf.consensus_migration_cache_size == null)
                                               ? Math.min(Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.01 / 1024 / 1024)), 50)
                                               : conf.consensus_migration_cache_size.toMebibytes();

            if (consensusMigrationCacheSizeInMiB < 0)
                throw new NumberFormatException(); // to escape duplicating error message
        }
        catch (NumberFormatException e)
        {
            throw new ConfigurationException("consensus_migration_cache_size option was set incorrectly to '"
                                             + conf.consensus_migration_cache_size + "', supported values are <integer> >= 0.", false);
        }

        // we need this assignment for the Settings virtual table - CASSANDRA-17735
        conf.counter_cache_size = new DataStorageSpec.LongMebibytesBound(counterCacheSizeInMiB);

        // if set to empty/"auto" then use 5% of Heap size
        indexSummaryCapacityInMiB = (conf.index_summary_capacity == null)
                                    ? Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.05 / 1024 / 1024))
                                    : conf.index_summary_capacity.toMebibytes();

        if (indexSummaryCapacityInMiB < 0)
            throw new ConfigurationException("index_summary_capacity option was set incorrectly to '"
                                             + conf.index_summary_capacity.toString() + "', it should be a non-negative integer.", false);

        // we need this assignment for the Settings virtual table - CASSANDRA-17735
        conf.index_summary_capacity = new DataStorageSpec.LongMebibytesBound(indexSummaryCapacityInMiB);

View on GitHub (pinned to 88fd0f6a0e)