apache/cassandra · error · IllegalArgumentException
Invalid compaction strategy:
Error message
Invalid compaction strategy:
What it means
OptionCompaction validates the compaction strategy class name by resolving it through CompactionParams.classFromName, which throws ConfigurationException for unknown classes. The option converts this into an IllegalArgumentException 'Invalid compaction strategy: <name>' so the CLI reports an actionable message.
Solutions
- Use a fully qualified valid strategy class, e.g. org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy
- Check spelling and casing of the strategy class name
- Verify the strategy exists in the Cassandra version being targeted (some strategies were added/removed across versions)
Example fix
// before -compaction strategy=LeveledStrategy // after -compaction strategy=org.apache.cassandra.db.compaction.LeveledCompactionStrategy
Defensive patterns
Strategy: validation
Validate before calling
try { CompactionParams.classFromName(strategyName); } catch (ConfigurationException e) { /* invalid strategy */ } Try / catch
try { applyCompaction(name); } catch (IllegalArgumentException e) { log.error("Bad compaction strategy '{}': use a fully qualified ICompactionStrategy class", name); } Prevention
- Use fully qualified compaction strategy class names
- Verify strategy availability in the target Cassandra version
- Validate -compaction values against the server's strategy list
When it happens
Trigger: Passing -compaction 'strategy=BadStrategy' or a strategy class name that is not on the classpath / not a valid ICompactionStrategy implementation to a stress command.
Common situations: Misspelled strategy names (e.g. 'SizeTieredCompactonStrategy'); using strategy names from a newer/older Cassandra version that no longer exist; custom strategies not shipped on the stress client's classpath.
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
- At most bytes may be in a compaction level; your…
- Cannot set concurrent_validations greater than…
- CAS is supported only for type 'samerow'
- compaction_throughput: is too large; it should be less than…
- concurrent_compactors should be strictly greater than 0…
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/ff1d83749fd767d9.
Report an issue: GitHub.
Appendix: source
Thrown at tools/stress/src/org/apache/cassandra/stress/settings/OptionCompaction.java:74
@Override
public boolean happy()
{
return true;
}
private static final class StrategyAdapter implements Function<String, String>
{
public String apply(String name)
{
try
{
CompactionParams.classFromName(name);
}
catch (ConfigurationException e)
{
throw new IllegalArgumentException("Invalid compaction strategy: " + name);
}
return name;
}
}
}
View on GitHub (pinned to 88fd0f6a0e)