apache/cassandra · error · IllegalArgumentException
Value of name_size parameter has to be at least %s.
Error message
Value of name_size parameter has to be at least %s.
What it means
Thrown by UUIDRoleNameGenerator.getSize() when the requested name_size is less than the generator-configured minimumNameSize. The requested size parsed fine but is below the configured lower bound for generated names.
Source
Thrown at src/java/org/apache/cassandra/db/guardrails/UUIDRoleNameGenerator.java:185
if (sizeObject instanceof String)
{
try
{
size = Integer.parseInt((String) sizeObject);
}
catch (Throwable t)
{
throw new IllegalArgumentException("Value '" + sizeObject + "' can't be converted to integer.");
}
}
else if (sizeObject instanceof Number)
size = ((Number) sizeObject).intValue();
else
throw new IllegalArgumentException("Unsupported object passed to resolve " + NAME_SIZE + ": " + sizeObject.getClass().getName());
if (size < minimumNameSize)
throw new IllegalArgumentException("Value of " + NAME_SIZE + " parameter has to be at least " + minimumNameSize + '.');
if (size > MAXIMUM_NAME_SIZE)
throw new IllegalArgumentException("Generator generates names of maximum length " + MAXIMUM_NAME_SIZE + ". " +
"You want to generate with length " + size + '.');
return size;
}
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Raise name_size to at least the configured minimumNameSize
- Lower the generator's minimum_name_size config option if shorter names are needed (within validateParameters bounds)
- Catch IllegalArgumentException and retry with a size >= minimumNameSize
Example fix
// before
options.put("name_size", "4"); // generator minimum is 8
// after
options.put("name_size", "8"); Defensive patterns
Strategy: validation
Validate before calling
int requested = Integer.parseInt((String) options.get("name_size"));
if (requested < generatorMinimumNameSize)
options.put("name_size", String.valueOf(generatorMinimumNameSize)); Type guard
boolean withinMinimum(Object v, int minimumNameSize) {
int n = (v instanceof Number) ? ((Number) v).intValue() : Integer.parseInt((String) v);
return n >= minimumNameSize;
} Try / catch
try {
generator.generate(options);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("has to be at least")) {
// retry with the minimum size stated in the message
} else throw e;
} Prevention
- Read the generator's configured minimum_name_size before requesting names
- Clamp requested sizes into [minimumNameSize, 36]
- Share the size bounds between config and callers
When it happens
Trigger: Calling generate(options) with name_size smaller than the 'minimum_name_size' the generator was configured with (e.g. generator minimum 8, request name_size=4).
Common situations: Callers unaware of the generator's configured minimum; configs where the caller-supplied name_size was tuned for a different generator instance.
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
- Generator generates names of maximum length %s. You want to
- MINIMUM_NAME_SIZE_CONFIG_OPTION has to be at least DEFAULT_M
- Value of name_size has to be strictly positive integer.
- Invalid data rate: ${value}. It shouldn't be more than ${max
- Invalid data rate: value must be non-negative
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/185cc0be092d3fcd.
Report an issue: GitHub.