{"record":{"id":"c96ef8af06c44187","repo":"apache/cassandra","slug":"invalid-replication-strategy","errorCode":null,"errorMessage":"Invalid replication strategy: ","messagePattern":"Invalid replication strategy: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"tools/stress/src/org/apache/cassandra/stress/settings/OptionReplication.java","lineNumber":91,"sourceCode":"        public String apply(String name)\n        {\n            String strategy = null;\n            for (String fullname : new String[] { name, \"org.apache.cassandra.locator.\" + name })\n            {\n                try\n                {\n                    FBUtilities.classForNameWithoutInitialization(fullname,\n                                                                  \"replication strategy\",\n                                                                  AbstractReplicationStrategy.class);\n                    strategy = fullname;\n                    break;\n                } catch (Exception ignore)\n                {\n                    // will throw below if strategy is still null\n                }\n            }\n            if (strategy == null)\n                throw new IllegalArgumentException(\"Invalid replication strategy: \" + name);\n            return strategy;\n        }\n    }\n\n}\n","sourceCodeStart":73,"sourceCodeEnd":97,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/tools/stress/src/org/apache/cassandra/stress/settings/OptionReplication.java#L73-L97","documentation":"OptionReplication resolves a replication strategy class name (e.g. NetworkTopologyStrategy) via a lookup of known strategies. When the name cannot be resolved to any known strategy class, apply() throws this IllegalArgumentException indicating the strategy name is invalid.","triggerScenarios":"Running cassandra-stress with a replication option whose strategy name does not match any known IStrategyFactory/strategy class, e.g. -node \"replication_strategy=SimpleReplication\" — the initial reflection/lookup attempt throws (caught and ignored) and strategy remains null.","commonSituations":"Typo like 'SimpleStrategyy' or 'Simple' instead of 'SimpleStrategy'; using a strategy that exists in newer Cassandra versions than the stress tool being run; wrong case (strategy names are matched exactly); copying a DSE-only strategy name into OSS cassandra-stress.","solutions":["Correct the strategy name spelling/casing to an exact match, e.g. 'SimpleStrategy' or 'NetworkTopologyStrategy'.","Check which replication strategies your Cassandra version supports and use one of those.","Pass the strategy with its required options, e.g. replication_factor=3 for SimpleStrategy or datacenter names for NetworkTopologyStrategy.","Use the default strategy by omitting the replication_strategy option entirely."],"exampleFix":"// before\nString opts = \"replication_strategy=SimpleReplication,replication_factor=3\";\n// after\nString opts = \"replication_strategy=SimpleStrategy,replication_factor=3\";","handlingStrategy":"validation","validationCode":"Set<String> valid = Set.of(\"SimpleStrategy\", \"NetworkTopologyStrategy\", \"LocalStrategy\", \"EverywhereStrategy\");\nif (!valid.contains(strategyName)) throw new IllegalArgumentException(\"unknown strategy: \" + strategyName);","typeGuard":null,"tryCatchPattern":"try { /* build settings */ } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Invalid replication strategy\")) { System.err.println(\"Use SimpleStrategy or NetworkTopologyStrategy\"); } else throw e; }","preventionTips":["Copy strategy names from official docs, never retype them.","Pin the stress tool version to your cluster version.","Prefer omitting replication_strategy to get the default."],"tags":["cli","configuration","replication"],"backgroundTag":"invalid-enum-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"}