apache/cassandra · warning
Unable to parse value
Error message
Unable to parse value %s of key %s. Value has to be integer. The default of value %s will be used.
What it means
CustomGuardrailConfig.resolveInteger parses a guardrail config value expected to be a String containing an integer. If the value cannot be parsed (NumberFormatException) or the value type is unsupported (IllegalStateException), the method logs this warning and falls back to the configured default value instead of failing startup.
Solutions
- Fix the config value for the offending key to be a valid integer string (e.g. '12' not 'twelve' or '12.0').
- Check the warn log line for the key and resolved value to identify which key is wrong.
- If the value is intentionally a non-String type, quote it in YAML or adjust the custom guardrail's config parsing to accept that type.
- Remove the key so the guardrail uses its default value.
Example fix
// before (cassandra.yaml)
custom_guardrails:
- name: password_policy
password_min_length: ten
// after
liquid(custom_guardrails):
- name: password_policy
password_min_length: 10 Defensive patterns
Strategy: validation
Validate before calling
Object v = config.get(key);
if (!(v instanceof String) || !((String) v).matches("-?\\d+")) {
throw new IllegalArgumentException("Key " + key + " must be an integer string, got: " + v);
} Type guard
boolean isIntegerString(Object v) { return v instanceof String && ((String) v).matches("-?\\d+"); } Prevention
- Quote integer values in YAML if the schema expects Strings.
- Validate guardrail config maps at deploy time with a schema check.
- Grep logs for this warning after every config change.
When it happens
Trigger: Setting a guardrail config key (e.g. via cassandra.yaml guardrails configuration or a custom guardrail's config map) to a non-integer string like "abc" or "10.5", or to a non-String object (e.g. Integer or Boolean), when resolveInteger is called by CassandraPasswordConfiguration or UUIDRoleNameGenerator during guardrail initialization.
Common situations: Typo or wrong unit in a YAML guardrail value (e.g. 'password length: ten'); YAML auto-typing turning a quoted number into a non-String type; copying config between versions where the value format changed.
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.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- Invalid parameterized class <providerClass.getName()>: must…
- Invalid class ' ': must extend or implement
- Invalid value for : minimum allowed value is 3, as CMS…
- Invalid value for : negative values are not allowed…
- Invalid value for data_disk_usage_max_disk_size
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/9ac6f6e74c62c73e.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/db/guardrails/CustomGuardrailConfig.java:84
public int resolveInteger(@Nullable String key, Integer defaultValue)
{
if (key == null)
return defaultValue;
Object resolvedValue = getOrDefault(key, defaultValue.toString());
try
{
if (resolvedValue instanceof Integer)
return (Integer) resolvedValue;
if (resolvedValue instanceof String)
return Integer.parseInt((String) resolvedValue);
throw new IllegalStateException();
}
catch (IllegalStateException | NumberFormatException ex)
{
logger.warn(format("Unable to parse value %s of key %s. Value has to be integer. " +
"The default of value %s will be used.",
resolvedValue, key, defaultValue));
}
return defaultValue;
}
public boolean resolveBoolean(@Nullable String key, boolean defaultValue)
{
Object value = get(key);
if (value == null)
return defaultValue;
if (value instanceof Boolean)
return (boolean) value;
if (value instanceof String)
return Boolean.parseBoolean((String) value);
return defaultValue;View on GitHub (pinned to 88fd0f6a0e)