apache/cassandra · error · ConfigurationException
Missing sub-option ' ' for the ' ' option
Error message
Missing sub-option '%s' for the '%s' option
What it means
When parsing a compaction options map, CompactionParams.fromMap requires a 'class' sub-option naming the compaction strategy. If it is absent, a ConfigurationException is thrown, since Cassandra cannot determine which ICompactionStrategy to instantiate.
Solutions
- Add the strategy class, e.g. compaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '4'}
- Ensure tooling preserves the 'class' key when transforming option maps
- Use fully qualified class names (org.apache.cassandra.db.compaction.*) for custom strategies
Example fix
// before
compaction = {'min_threshold': '4'}
// after
compaction = {'class': 'SizeTieredCompactionStrategy', 'min_threshold': '4'} Defensive patterns
Strategy: validation
Validate before calling
if (!compactionMap.containsKey("class"))
throw new IllegalArgumentException("compaction map requires a 'class' sub-option"); Type guard
boolean hasCompactionClass(Map<String,String> m) { return m != null && m.containsKey("class") && !m.get("class").trim().isEmpty(); } Try / catch
try { compactionParams = CompactionParams.fromMap(map); } catch (ConfigurationException e) { if (e.getMessage().contains("Missing sub-option")) { /* add class key */ } throw e; } Prevention
- Always include the strategy class in compaction maps
- Ensure map-merging utilities preserve the 'class' key
- Use full class names for custom strategies
When it happens
Trigger: ALTER TABLE ... WITH compaction = {'min_threshold': '4'} (no 'class' key); programmatic fromMap calls on maps that only carry tuning options.
Common situations: Hand-written DDL omitting the class; tooling that merges option maps and drops the class key; users confusing compression and compaction option shapes.
Understand the failure class
Background: "Must pass :limit option" / "Missing required option" — required option errors explained — this error's family across 41 libraries.
Related errors
- Invalid value for ' ' compaction sub-option - must be an…
- ACCESS TO DATACENTERS operations not supported by…
- ALREADY_EXISTS
- Already exists
- Because of this name
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/d9b55cebf1361b16.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/schema/CompactionParams.java:301
public boolean onlyPurgeRepairedTombstones()
{
return onlyPurgeRepairedTombstones;
}
public boolean isEnabled()
{
return isEnabled;
}
public static CompactionParams fromMap(Map<String, String> map)
{
Map<String, String> options = new HashMap<>(map);
String className = options.remove(Option.CLASS.toString());
if (className == null)
{
throw new ConfigurationException(format("Missing sub-option '%s' for the '%s' option",
Option.CLASS,
TableParams.Option.COMPACTION));
}
return create(classFromName(className), options);
}
public static Class<? extends AbstractCompactionStrategy> classFromName(String name)
{
String className = name.contains(".")
? name
: "org.apache.cassandra.db.compaction." + name;
return FBUtilities.classForNameWithoutInitialization(className, "compaction strategy", AbstractCompactionStrategy.class);
}
/*
* LCS doesn't, STCS and DTCS do
*/View on GitHub (pinned to 88fd0f6a0e)