apache/cassandra · error · ConfigurationException
is not valid for
Error message
%s is not valid for %s
What it means
ConfigurationException thrown by TimeWindowCompactionStrategyOptions.validateOptions when the timestamp_resolution option is not one of the accepted time units (seconds, milliseconds, minutes, hours) or is not a valid TimeUnit name at all. The same message is used both when the value parses to a TimeUnit that isn't in the valid set and when TimeUnit.valueOf throws IllegalArgumentException for an unknown name.
Solutions
- Set timestamp_resolution to one of SECONDS, MILLISECONDS, MINUTES or HOURS (default MILLISECONDS).
- Remove the option to use the default resolution.
- Match the resolution to how the table's write timestamp is actually generated.
Example fix
// before
{'class':'TimeWindowCompactionStrategy','timestamp_resolution':'MICROSECONDS'}
// after
{'class':'TimeWindowCompactionStrategy','timestamp_resolution':'MILLISECONDS'} Defensive patterns
Strategy: validation
Validate before calling
Set<String> valid = Set.of("SECONDS","MILLISECONDS","MINUTES","HOURS");
if (opts.containsKey("timestamp_resolution") && !valid.contains(opts.get("timestamp_resolution"))) throw new IllegalArgumentException("timestamp_resolution must be one of " + valid); Try / catch
try { schema.alterTable(cql); } catch (ConfigurationException e) { if (e.getMessage().contains("TIMESTAMP_RESOLUTION_KEY")) { /* use a valid unit name and retry */ } else throw e; } Prevention
- Only use SECONDS, MILLISECONDS, MINUTES or HOURS — not arbitrary TimeUnit constants.
- Match the resolution to the timestamp source of the table (usually MILLISECONDS).
- Keep option values exact-case uppercase TimeUnit names.
When it happens
Trigger: CREATE/ALTER TABLE with {'class':'TimeWindowCompactionStrategy','timestamp_resolution':'MICROSECONDS'} (valid TimeUnit, not in validTimestampTimeUnits) or 'timestamp_resolution':'sec' (not a TimeUnit constant, caught as IllegalArgumentException).
Common situations: Choosing an unsupported resolution like DAYS or MICROSECONDS; abbreviating unit names ('secs'); copy-pasting options from a different system that accepts arbitrary ChronoUnit names.
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
- must be greater than 1 for
- At most bytes may be in a compaction level; your…
- Cannot set concurrent_validations greater than…
- 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/914527c2f4dfbbbe.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java:101
public TimeWindowCompactionStrategyOptions()
{
sstableWindowUnit = DEFAULT_COMPACTION_WINDOW_UNIT;
timestampResolution = DEFAULT_TIMESTAMP_RESOLUTION;
sstableWindowSize = DEFAULT_COMPACTION_WINDOW_SIZE;
expiredSSTableCheckFrequency = TimeUnit.MILLISECONDS.convert(DEFAULT_EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS, TimeUnit.SECONDS);
ignoreOverlaps = DEFAULT_UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION;
stcsOptions = new SizeTieredCompactionStrategyOptions();
}
public static Map<String, String> validateOptions(Map<String, String> options, Map<String, String> uncheckedOptions) throws ConfigurationException
{
String optionValue = options.get(TIMESTAMP_RESOLUTION_KEY);
try
{
if (optionValue != null)
if (!validTimestampTimeUnits.contains(TimeUnit.valueOf(optionValue)))
throw new ConfigurationException(String.format("%s is not valid for %s", optionValue, TIMESTAMP_RESOLUTION_KEY));
}
catch (IllegalArgumentException e)
{
throw new ConfigurationException(String.format("%s is not valid for %s", optionValue, TIMESTAMP_RESOLUTION_KEY));
}
optionValue = options.get(COMPACTION_WINDOW_UNIT_KEY);
try
{
if (optionValue != null)
if (!validWindowTimeUnits.contains(TimeUnit.valueOf(optionValue)))
throw new ConfigurationException(String.format("%s is not valid for %s", optionValue, COMPACTION_WINDOW_UNIT_KEY));
}
catch (IllegalArgumentException e)
{
throw new ConfigurationException(String.format("%s is not valid for %s", optionValue, COMPACTION_WINDOW_UNIT_KEY), e);View on GitHub (pinned to 88fd0f6a0e)