{"record":{"id":"3d68ba6df618ab55","repo":"apache/cassandra","slug":"invalid-double-value-s-for-s","errorCode":null,"errorMessage":"Invalid double value %s for '%s'","messagePattern":"Invalid double value (.+?) for '(.+?)'","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":180,"sourceCode":"\n    public double getDouble(String key, double defaultValue) throws SyntaxException\n    {\n        String value = getString(key);\n        return value != null ? parseDouble(key, value) : defaultValue;\n    }\n\n    public static double parseDouble(String key, String value) throws SyntaxException\n    {\n        if (null == value)\n            throw new IllegalArgumentException(\"value argument can't be null\");\n\n        try\n        {\n            return Double.parseDouble(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new SyntaxException(format(\"Invalid double value %s for '%s'\", value, key));\n        }\n    }\n\n    public Object getProperty(String name)\n    {\n        Object ret = properties.get(name);\n        if (ret == null)\n            throw new SyntaxException(String.format(\"Invalid value for property '%s'. It should not be null.\", name));\n\n        return ret;\n    }\n}\n","sourceCodeStart":162,"sourceCodeEnd":193,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L162-L193","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nALTER TABLE t WITH crc_check_chance = 1,0;\n// after\nALTER TABLE t WITH crc_check_chance = 1.0;","handlingStrategy":"validation","validationCode":"const n = Number(String(value).trim().replace(',', '.')); if (!Number.isFinite(n)) throw new Error(`Invalid double for ${key}: ${value}`);","typeGuard":"function isNumericLiteral(v) { return /^-?\\d+(\\.\\d+)?$/.test(String(v).trim()); }","tryCatchPattern":"try { runCql(stmt); } catch (e) { if (/Invalid double value .* for/.test(e.message)) normalizeNumericProps(stmt); else throw e; }","preventionTips":["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"],"tags":["cql","double","property-parsing"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}