apache/cassandra · error · SyntaxException
Invalid double value
Error message
Invalid double value %s for '%s'
What it means
PropertyDefinitions.parseDouble() (via getDouble) parses a double-typed CQL property value with Double.parseDouble and converts NumberFormatException into a SyntaxException 'Invalid double value %s for %s'. It indicates the named property expects a numeric (fractional-capable) value but received a non-numeric string.
Solutions
- Provide a plain numeric literal, e.g. 0.05 or 99.0
- Convert percent notation (50%) to a decimal (0.5) if the option expects a fraction
- Replace locale decimal commas with dots
- Trim whitespace and stray quotes from the value
Example fix
// before ALTER TABLE t WITH crc_check_chance = 1,0; // after ALTER TABLE t WITH crc_check_chance = 1.0;
Defensive patterns
Strategy: validation
Validate before calling
const n = Number(String(value).trim().replace(',', '.')); if (!Number.isFinite(n)) throw new Error(`Invalid double for ${key}: ${value}`); Type guard
function isNumericLiteral(v) { return /^-?\d+(\.\d+)?$/.test(String(v).trim()); } Try / catch
try { runCql(stmt); } catch (e) { if (/Invalid double value .* for/.test(e.message)) normalizeNumericProps(stmt); else throw e; } Prevention
- Use dot as decimal separator regardless of client locale
- Convert percent values to fractions when the option expects a ratio
- Trim whitespace/quotes from numeric values before building CQL
When it happens
Trigger: Setting properties like speculative_retry percent values or other double options with values such as 'high', '0.5x', '50 %', or empty strings in CREATE/ALTER TABLE statements.
Common situations: Percent values written as '50%' instead of 0.5; symbolic values where a number is required; trailing whitespace or locale decimal commas (0,5) pasted from non-English locales.
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
- Cannot parse 64-bits double value from
- Invalid boolean value
- Invalid integer value
- Invalid value for property
- Invalid value for property
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/3d68ba6df618ab55.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java:180
public double getDouble(String key, double defaultValue) throws SyntaxException
{
String value = getString(key);
return value != null ? parseDouble(key, value) : defaultValue;
}
public static double parseDouble(String key, String value) throws SyntaxException
{
if (null == value)
throw new IllegalArgumentException("value argument can't be null");
try
{
return Double.parseDouble(value);
}
catch (NumberFormatException e)
{
throw new SyntaxException(format("Invalid double value %s for '%s'", value, key));
}
}
public Object getProperty(String name)
{
Object ret = properties.get(name);
if (ret == null)
throw new SyntaxException(String.format("Invalid value for property '%s'. It should not be null.", name));
return ret;
}
}
View on GitHub (pinned to 88fd0f6a0e)