apache/cassandra · error · ConfigurationException
Invalid value '%s' for caching sub-option '%s': only '%s', '
Error message
Invalid value '%s' for caching sub-option '%s': only '%s', '%s', and integer values are allowed
What it means
The 'rows_per_partition' caching sub-option accepts only 'ALL', 'NONE', or a plain integer. rowsPerPartitionFromString throws ConfigurationException for any other value while parsing the option during schema statements.
Source
Thrown at src/java/org/apache/cassandra/schema/CachingParams.java:153
}
String keysAsString()
{
return cacheKeys ? ALL : NONE;
}
private static int rowsPerPartitionFromString(String value)
{
if (value.equalsIgnoreCase(ALL))
return Integer.MAX_VALUE;
if (value.equalsIgnoreCase(NONE))
return 0;
if (StringUtils.isNumeric(value))
return Integer.parseInt(value);
throw new ConfigurationException(format("Invalid value '%s' for caching sub-option '%s':"
+ " only '%s', '%s', and integer values are allowed",
value,
Option.ROWS_PER_PARTITION,
ALL,
NONE));
}
String rowsPerPartitionAsString()
{
if (rowsPerPartitionToCache == 0)
return NONE;
else if (rowsPerPartitionToCache == Integer.MAX_VALUE)
return ALL;
else
return Integer.toString(rowsPerPartitionToCache);
}
@OverrideView on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set rows_per_partition to 'ALL', 'NONE', or a plain integer like '100'
- Remove the sub-option to use the default
- Verify the string contains only digits (StringUtils.isNumeric is used)
Example fix
// before
caching = {'rows_per_partition': 'auto'}
// after
caching = {'rows_per_partition': '200'} Defensive patterns
Strategy: validation
Validate before calling
String v = cachingMap.get("rows_per_partition");
if (v != null && !(v.equalsIgnoreCase("ALL") || v.equalsIgnoreCase("NONE") || v.matches("\\d+"))) throw new IllegalArgumentException("rows_per_partition must be ALL, NONE, or an integer"); Type guard
boolean isValidRowsPerPartition(String v) { return "ALL".equalsIgnoreCase(v) || "NONE".equalsIgnoreCase(v) || v.matches("\\d+"); } Try / catch
try { session.execute(ddl); } catch (InvalidQueryException e) { if (e.getMessage().contains("rows_per_partition")) { /* correct the value and retry */ } else throw e; } Prevention
- Represent row counts as integers in config, stringify only at DDL generation
- Reject floats/units in config parsing before they reach DDL
- Test generated DDL against a scratch keyspace in CI
When it happens
Trigger: CREATE TABLE ... WITH caching = {'rows_per_partition': 'auto'} or {'rows_per_partition': '10.5'} or {'rows_per_partition': '100 rows'} — anything that is not ALL, NONE, or a numeric string.
Common situations: Using descriptive words instead of numbers (e.g. 'default'), floating-point counts, or values with units; confusion with pre-3.0 caching option names like 'rows_per_partition_to_cache'.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- MapType takes exactly 2 type parameters
- Invalid value %s for '%s' repair sub-option - must be an int
- Invalid caching sub-options %s: only '%s' and '%s' are allow
- Invalid value '%s' for caching sub-option '%s': only '%s' an
- Invalid value %s for '%s' compaction sub-option - must be an
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/bcfd226266b2ab07.
Report an issue: GitHub.