apache/cassandra · error · IllegalStateException
Unable to parse value
Error message
Unable to parse value %s
What it means
GuardrailsConfigCommand.getNumber applies a numeric transformer (e.g. Integer.parseInt) to the user-supplied option value. If the value is not a valid number, NumberFormatException is caught and rethrown as IllegalStateException with 'Unable to parse value <value>'. This means the CLI argument passed for a numeric guardrail property is not parseable as the expected number type.
Solutions
- Pass a plain unformatted number, e.g. `--warning-threshold=5000`
- Strip units/separators/whitespace before passing the value in scripts
- Verify the property actually expects a number and not a set/string value
- Check the exception's cause (NumberFormatException) for the exact offending string
Example fix
// before nodetool guardrails-config set read-risk --warning-threshold="5,000" // after nodetool guardrails-config set read-risk --warning-threshold=5000
Defensive patterns
Strategy: validation
Validate before calling
// validate numeric shell variable before passing to nodetool
[[ "$VAL" =~ ^-?[0-9]+$ ]] || { echo "VAL must be an integer"; exit 1; } Try / catch
try { runNodetool("guardrails-config","set",prop,"--warning-threshold="+val); } catch (IllegalStateException e) { log("Bad numeric value: " + val, e); } Prevention
- Never pass formatted numbers (commas, %, units) to numeric nodetool options
- Trim whitespace in scripts before interpolating values
- Check the NumberFormatException cause to confirm the offending string
When it happens
Trigger: `nodetool guardrails-config` set with a numeric property given a non-numeric value, e.g. `--warning-threshold=ten` or `5,000` with a thousands separator; an empty string; negative sign mistakes or locale-specific formatting.
Common situations: Typing a percentage with a % sign, using comma thousands separators, pasting values with trailing whitespace, or setting a value to text by accident in shell scripts.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- argument for top must be a positive integer.
- arguments for -F are json,yaml only.
- Can not parse replication factor
- Keyspace [ ] does not exist.
- Number of commands to display has to be at least 1.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/7f8795e6ed8c6640.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/nodetool/GuardrailsConfigCommand.java:349
}
else
{
throw new IllegalArgumentException(format("unsupported type: %s", targetType));
}
}
private <T> T getNumber(String value, Function<String, T> transformer, T defaultValue)
{
if (value == null || value.equals("null"))
return defaultValue;
try
{
return transformer.apply(value);
}
catch (NumberFormatException ex)
{
throw new IllegalStateException(format("Unable to parse value %s", value), ex);
}
}
}
private static final Pattern CAMEL_PATTERN = Pattern.compile("([a-z])([A-Z])");
/**
* Special map for methods which do not adhere to camel-case convention precisely.
* These will be translated manually.
*/
private static final Map<String, String> toSnakeCaseTranslationMap = Map.of("ZeroTTLOnTWCSEnabled", "zero_ttl_on_twcs_enabled",
"ZeroTTLOnTWCSWarned", "zero_ttl_on_twcs_warned",
"FieldsPerUDTFailThreshold", "fields_per_udt_fail_threshold",
"FieldsPerUDTWarnThreshold", "fields_per_udt_warn_threshold",
"FieldsPerUDTThreshold", "fields_per_udt_threshold",
"SimpleStrategyEnabled", "simplestrategy_enabled",
"NonPartitionRestrictedQueryEnabled", "non_partition_restricted_index_query_enabled");
View on GitHub (pinned to 88fd0f6a0e)