{"record":{"id":"03bc416e78f44b18","repo":"apache/cassandra","slug":"your-replication-factor-for-keyspace-is-high-03bc41","errorCode":null,"errorMessage":"Your replication factor {} for keyspace {} is higher than the number of nodes {}","messagePattern":"Your replication factor (.+?) for keyspace (.+?) is higher than the number of nodes (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/locator/SimpleStrategy.java","lineNumber":154,"sourceCode":"    }\n\n    @Override\n    public void maybeWarnOnOptions(ClientState state)\n    {\n        if (!SchemaConstants.isSystemKeyspace(keyspaceName))\n        {\n            int nodeCount = StorageService.instance.getHostIdToEndpoint().size();\n            // nodeCount==0 on many tests\n            Guardrails.minimumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);\n            Guardrails.maximumReplicationFactor.guard(rf.fullReplicas, keyspaceName, false, state);\n            if (rf.fullReplicas > nodeCount && nodeCount != 0)\n            {\n                String msg = \"Your replication factor \" + rf.fullReplicas\n                             + \" for keyspace \"\n                             + keyspaceName\n                             + \" is higher than the number of nodes \"\n                             + nodeCount;\n                ClientWarn.instance.warn(msg);\n                logger.warn(msg);\n            }\n        }\n    }\n\n    @Override\n    public Collection<String> recognizedOptions(ClusterMetadata metadata)\n    {\n        return Collections.singleton(REPLICATION_FACTOR);\n    }\n\n    @SuppressWarnings(\"unused\") // used via reflection\n    protected static void prepareOptions(Map<String, String> options, Map<String, String> previousOptions)\n    {\n        // When altering from NTS to SS, previousOptions could have multiple different RFs for different data centers - so we\n        // will instead default to DefaultRF configuration if RF is not mentioned with the alter statement\n        String rf = previousOptions.containsKey(REPLICATION_FACTOR) ? previousOptions.get(REPLICATION_FACTOR)\n                                                                    : Integer.toString(DatabaseDescriptor.getDefaultKeyspaceRF());","sourceCodeStart":136,"sourceCodeEnd":172,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/locator/SimpleStrategy.java#L136-L172","documentation":"Guardrail warning raised in SimpleStrategy.maybeWarnOnOptions: the keyspace's replication factor exceeds the current number of nodes in the cluster, so some replicas of each row cannot exist. Skipped for system keyspaces and when nodeCount is 0 (common in tests).","triggerScenarios":"Thrown at src/java/org/apache/cassandra/locator/SimpleStrategy.java:154 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Lower the replication factor via ALTER KEYSPACE to match or stay below node count.","Add nodes to the cluster if higher redundancy is intended."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}