apache/cassandra · error · IllegalArgumentException
Invalid replication strategy:
Error message
Invalid replication strategy:
What it means
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.
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.
Example fix
// before String opts = "replication_strategy=SimpleReplication,replication_factor=3"; // after String opts = "replication_strategy=SimpleStrategy,replication_factor=3";
Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("SimpleStrategy", "NetworkTopologyStrategy", "LocalStrategy", "EverywhereStrategy");
if (!valid.contains(strategyName)) throw new IllegalArgumentException("unknown strategy: " + strategyName); Try / catch
try { /* build settings */ } catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Invalid replication strategy")) { System.err.println("Use SimpleStrategy or NetworkTopologyStrategy"); } else throw e; } Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Can not parse replication factor
- Cannot alter RF while some endpoints are not in normal…
- CAS is supported only for type 'samerow'
- default_keyspace_rf cannot be less than 1
- default_keyspace_rf ( ) cannot be less than…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c96ef8af06c44187.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/OptionReplication.java:91
public String apply(String name)
{
String strategy = null;
for (String fullname : new String[] { name, "org.apache.cassandra.locator." + name })
{
try
{
FBUtilities.classForNameWithoutInitialization(fullname,
"replication strategy",
AbstractReplicationStrategy.class);
strategy = fullname;
break;
} catch (Exception ignore)
{
// will throw below if strategy is still null
}
}
if (strategy == null)
throw new IllegalArgumentException("Invalid replication strategy: " + name);
return strategy;
}
}
}
View on GitHub (pinned to 88fd0f6a0e)