apache/cassandra · error · ConfigurationException
%s must be a positive number, got %s
Error message
%s must be a positive number, got %s
What it means
ParameterizedFastPathStrategy.fromMap() parses the 'size' option from a string map of fast-path strategy options. If the value cannot be parsed as an integer (NumberFormatException), a ConfigurationException is thrown with this message. The 'positive number' wording means the value must be a valid positive integer.
Source
Thrown at src/java/org/apache/cassandra/service/accord/topology/ParameterizedFastPathStrategy.java:253
private static ConfigurationException cfe(String fmt, Object... args)
{
return new ConfigurationException(String.format(fmt, args));
}
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))
{View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set the 'size' option to a plain positive integer string, e.g. {"size": "100"}
- Remove unit suffixes or decimals ("10.5", "100ms") — only integers are accepted
- Check for invisible whitespace or non-ASCII characters in the configured value
Example fix
// before
Map<String,String> opts = Map.of("size", "10.5");
ParameterizedFastPathStrategy.fromMap(opts); // throws
// after
Map<String,String> opts = Map.of("size", "10");
ParameterizedFastPathStrategy.fromMap(opts); // ok Defensive patterns
Strategy: validation
Validate before calling
String size = map.get("size");
if (size == null || !size.trim().matches("\\d+"))
throw new IllegalArgumentException("size must be a positive integer, got: " + size); Prevention
- Store strategy options as typed values, converting to string only at the boundary
- Validate configuration at startup, before it reaches fromMap()
When it happens
Trigger: Calling ParameterizedFastPathStrategy.fromMap() with a map whose 'size' entry is not parseable by Integer.parseInt, e.g. "size" -> "abc", "10.5", "", or "100ms".
Common situations: Typing a decimal or unit-suffixed value in cassandra.yaml / nodetool fast-path configuration; copy-pasting strategy options with stray whitespace or locale-formatted numbers.
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
- Invalid accord progress log configuration:
- Concurrent accord operations must be non-negative
- DC weights must be zero or positive
- %s must be greater than zero
- %s must specify at least one DC
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/462c6fecb5a0fa7e.
Report an issue: GitHub.