apache/cassandra · error · IllegalArgumentException
Unsupported object passed to resolve name_size: %s
Error message
Unsupported object passed to resolve name_size: %s
What it means
Thrown by UUIDRoleNameGenerator.getSize() when the resolved name_size object is neither a String nor a Number — i.e. an unsupported type such as Boolean, Map, or List. The message includes the class name of the offending object.
Source
Thrown at src/java/org/apache/cassandra/db/guardrails/UUIDRoleNameGenerator.java:182
}
int size;
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
- Ensure name_size is a String or Number before calling generate
- Fix config so name_size is a scalar integer value, not a nested structure
- Pre-validate with an instanceof (String || Number) check
Example fix
// before
options.put("name_size", Map.of("min", 8));
// after
options.put("name_size", "8"); Defensive patterns
Strategy: type-guard
Validate before calling
Object v = options.get("name_size");
if (v != null && !(v instanceof String) && !(v instanceof Number))
throw new IllegalArgumentException("name_size must be String or Number"); Type guard
boolean isStringOrNumber(Object v) { return v instanceof String || v instanceof Number; } Try / catch
try {
generator.generate(options);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("Unsupported object passed to resolve name_size")) {
// coerce the value to a String/Number and retry
} else throw e;
} Prevention
- Ensure config deserialization yields scalar values for name_size
- Pre-check instanceof String/Number before calling generate
- Log the class name (per the message) to find the misconfigured source
When it happens
Trigger: Calling generate(options) with options.get("name_size") being any object that is not String or Number, e.g. a nested map from a misparsed config.
Common situations: Config layers deserializing 'name_size' into unexpected types (e.g. a YAML mapping instead of a scalar); programmatic misuse passing an enum or object wrapper.
Understand the failure class
Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.
Related errors
- Value of %s is not a string.
- Value of %s cannot be null.
- Value '%s' can't be converted to integer.
- Value of name_size has to be strictly positive integer.
- Value of name_size parameter has to be at least %s.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/73e921e2dacb489e.
Report an issue: GitHub.