{"record":{"id":"6f69a05bb4f06563","repo":"apache/cassandra","slug":"consensus-migration-cache-size-option-was-set-inco","errorCode":null,"errorMessage":"consensus_migration_cache_size option was set incorrectly to '<value>', supported values are <integer> >= 0.","messagePattern":"consensus_migration_cache_size option was set incorrectly to '<value>', supported values are <integer> >= 0\\.","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/config/DatabaseDescriptor.java","lineNumber":1090,"sourceCode":"        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(\"accord.working_set_size option was set incorrectly to '\"\n                                             + conf.accord.working_set_size + \"', supported values are <integer> >= 0.\", false);\n        }\n\n        try\n        {\n            // if consensusMigrationCacheSizeInMiB option was set to \"auto\" then size of the cache should be \"min(1% of Heap (in MB), 50MB)\n            consensusMigrationCacheSizeInMiB = (conf.consensus_migration_cache_size == null)\n                                               ? Math.min(Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.01 / 1024 / 1024)), 50)\n                                               : conf.consensus_migration_cache_size.toMebibytes();\n\n            if (consensusMigrationCacheSizeInMiB < 0)\n                throw new NumberFormatException(); // to escape duplicating error message\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(\"consensus_migration_cache_size option was set incorrectly to '\"\n                                             + conf.consensus_migration_cache_size + \"', supported values are <integer> >= 0.\", false);\n        }\n\n        // we need this assignment for the Settings virtual table - CASSANDRA-17735\n        conf.counter_cache_size = new DataStorageSpec.LongMebibytesBound(counterCacheSizeInMiB);\n\n        // if set to empty/\"auto\" then use 5% of Heap size\n        indexSummaryCapacityInMiB = (conf.index_summary_capacity == null)\n                                    ? Math.max(1, (int) (Runtime.getRuntime().totalMemory() * 0.05 / 1024 / 1024))\n                                    : conf.index_summary_capacity.toMebibytes();\n\n        if (indexSummaryCapacityInMiB < 0)\n            throw new ConfigurationException(\"index_summary_capacity option was set incorrectly to '\"\n                                             + conf.index_summary_capacity.toString() + \"', it should be a non-negative integer.\", false);\n\n        // we need this assignment for the Settings virtual table - CASSANDRA-17735\n        conf.index_summary_capacity = new DataStorageSpec.LongMebibytesBound(indexSummaryCapacityInMiB);\n","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/config/DatabaseDescriptor.java#L1072-L1108","documentation":"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.","triggerScenarios":"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.","commonSituations":"Sign typo when hand-editing yaml; templating accident producing negative numbers; misreading the option as a percentage rather than a storage bound.","solutions":["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).","Validate the yaml with a lint/check before restart.","Restart the node after fixing."],"exampleFix":"# before\nconsensus_migration_cache_size: -10MiB\n# after\nconsensus_migration_cache_size: 50MiB","handlingStrategy":"validation","validationCode":"Object v = yaml.get(\"consensus_migration_cache_size\");\nif (v != null && String.valueOf(v).trim().startsWith(\"-\"))\n    throw new IllegalArgumentException(\"consensus_migration_cache_size must be >= 0\");","typeGuard":"boolean isValidCacheSize(Object v) {\n    return v == null || (v instanceof Number && ((Number) v).longValue() >= 0);\n}","tryCatchPattern":"try {\n    DatabaseDescriptor.applySimpleConfig();\n} catch (ConfigurationException e) {\n    if (e.getMessage().contains(\"consensus_migration_cache_size\"))\n        logger.error(\"Set consensus_migration_cache_size to a positive MiB value or remove it: {}\", e.getMessage());\n}","preventionTips":["Remove the key entirely to get the default min(1% heap, 50MB)","Check for stray minus signs when editing yaml","Keep config changes in version control and review diffs"],"tags":["config","startup","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}