apache/cassandra · error · ConfigurationException
%s must be greater than zero
Error message
%s must be greater than zero
What it means
After successfully parsing the 'size' option as an integer, fromMap() validates it is at least 1. A size of zero or negative is rejected with a ConfigurationException, since a fast-path coordinator quorum must contain at least one replica.
Source
Thrown at src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java:257
}
public static ParameterizedFastPathStrategy fromMap(Map<String, String> map)
{
if (!map.containsKey(SIZE))
throw cfe("fast_path must be set to 'keyspace' or 'default' or a map defining '%s' and optionally '%s'", SIZE, DCS);
int size;
try
{
size = Integer.parseInt(map.get(SIZE));
}
catch (NumberFormatException e)
{
throw cfe("%s must be a positive number, got %s", SIZE, map.get(SIZE));
}
if (size < 1)
throw cfe("%s must be greater than zero", SIZE);
ImmutableMap<String, WeightedDc> dcMap;
if (map.containsKey(DCS) && !map.get(DCS).isEmpty())
{
Map<String, WeightedDc> mutableDcs = new HashMap<>();
String dcsString = map.get(DCS);
if (dcsString.trim().isEmpty())
throw cfe("%s must specify at least one DC", DCS);
int autoIdx = 0;
boolean hasAuto = false;
boolean hasManual = false;
for (String dcString : COMMA_SEPARATOR.split(dcsString))
{
WeightedDc dc = WeightedDc.fromString(dcString, autoIdx++);
if (mutableDcs.containsKey(dc.name))
throw cfe("Multiple entries for DC %s", dc.name);
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set 'size' to a positive integer (>= 1)
- If the fast path should be disabled, remove the 'size' key entirely rather than setting 0
- Clamp generated/config-managed values to >= 1 before passing to fromMap()
Example fix
// before
Map<String,String> opts = Map.of("size", "0");
ParameterizedFastPathStrategy.fromMap(opts); // throws
// after
Map<String,String> opts = Map.of("size", "1");
ParameterizedFastPathStrategy.fromMap(opts); // ok Defensive patterns
Strategy: validation
Validate before calling
int size = Integer.parseInt(map.get("size"));
if (size < 1)
throw new IllegalArgumentException("size must be >= 1, got: " + size); Prevention
- Never use 0 to 'disable' an option — omit the key instead
- Clamp values from external sources to a sane minimum before applying configuration
When it happens
Trigger: Calling fromMap() with {"size": "0"} or {"size": "-5"} — any integer less than 1.
Common situations: Disabling the fast path by setting size to 0 instead of omitting/unsetting the option; hand-editing configuration with a negative value.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Invalid accord progress log configuration:
- Concurrent accord operations must be non-negative
- DC weights must be zero or positive
- %s must be a positive number, got %s
- %s must specify at least one DC
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/c055caa3da15229b.
Report an issue: GitHub.