apache/cassandra · error · NumberFormatException
Missing separator
Error message
Missing separator
What it means
parseHumanReadable supports values combining a number and a second component separated by a literal separator (e.g. '4x2GB' or '2 x 5GB'). This NumberFormatException is thrown when the expected separator string is not found at the position right after the parsed number.
Solutions
- Use the exact separator the caller expects (e.g. write 4x2GB when 'x' is the separator)
- Remove extra whitespace if the separator match is exact (e.g. use '4x2GB' not '4 x 2GB' when separator is 'x')
- Check the calling code to see which separator string it passes and match it in your config
- Make the separator optional in the caller if both forms should be accepted
Example fix
// before: parseHumanReadable("4*2GB", "x", "GB")
// after: parseHumanReadable("4x2GB", "x", "GB") Defensive patterns
Strategy: validation
Validate before calling
if (separator != null && !value.contains(separator)) throw new IllegalArgumentException("expected separator '" + separator + "' in " + value); Try / catch
try { return FBUtilities.parseHumanReadable(s, "x", "GB"); } catch (NumberFormatException e) { throw new ConfigurationException("Value '" + s + "' must look like '4x2GB'", e); } Prevention
- Match the exact separator character the calling code expects
- Document the accepted value format next to the config option
- Normalize whitespace before parsing
When it happens
Trigger: Calling parseHumanReadable(datum, separator, unit) where datum contains a number+unit but lacks the required separator, e.g. parseHumanReadable("4x2GB", "x", "GB") given "4*2GB" or "4 2GB".
Common situations: Config values using a different separator character than the caller expects (asterisk vs 'x'), missing separator entirely, or extra whitespace preventing an exact match.
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.
Related errors
- does not end in unit
- Unable to make long from
- Unexpected characters between pos
- A CQL blob string must have an even length (since one byte…
- An hex string representing bytes must have an even length
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/e204f2871e2531bd.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/utils/FBUtilities.java:1143
double v = Double.parseDouble(m.group(0));
int pos = m.end();
if (m.group(2) == null) // possible binary exponent, parse
{
m = BINARY_EXPONENT.matcher(datum);
m.region(pos, end);
if (m.lookingAt())
{
int power = Integer.parseInt(m.group(1));
v = Math.scalb(v, power);
pos = m.end();
}
}
if (separator != null)
{
if (!datum.startsWith(separator, pos))
throw new NumberFormatException("Missing separator " + separator + " in " + datum);
pos += separator.length();
}
else
{
while (pos < end && Character.isWhitespace(datum.charAt(pos)))
++pos;
}
if (pos < end)
{
char prefixChar = datum.charAt(pos);
int prefixIndex = UNIT_PREFIXES.indexOf(prefixChar);
if (prefixIndex >= 0)
{
prefixIndex -= UNIT_PREFIXES_BASE;
++pos;
if (pos < end && datum.charAt(pos) == 'i')
{View on GitHub (pinned to 88fd0f6a0e)