{"record":{"id":"d4272839159a145e","repo":"apache/cassandra","slug":"invalid-integer-value-s-for-s","errorCode":null,"errorMessage":"Invalid integer value %s for '%s'","messagePattern":"Invalid integer value (.+?) for '(.+?)'","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":159,"sourceCode":"\n    public int getInt(String key, int defaultValue) throws SyntaxException\n    {\n        String value = getString(key);\n        return value != null ? parseInt(key, value) : defaultValue;\n    }\n\n    public static int parseInt(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 Integer.parseInt(value);\n        }\n        catch (NumberFormatException e)\n        {\n            throw new SyntaxException(format(\"Invalid integer value %s for '%s'\", value, key));\n        }\n    }\n\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        }","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L141-L177","documentation":"PropertyDefinitions.parseInt() (via getInt) parses an integer-typed CQL property value with Integer.parseInt and wraps any NumberFormatException into a SyntaxException 'Invalid integer value %s for %s'. It means the property named in the message was given a value that is not a syntactically valid 32-bit integer.","triggerScenarios":"Supplying e.g. WITH comment-typed numeric properties such as gc_grace_seconds = 'forever', min/max-index-keys = 1024.5, or values with thousands separators (1_000, 1,000) in CREATE/ALTER TABLE or keyspace statements.","commonSituations":"Durations spelled as '5s' instead of seconds as an integer; decimal points in integer options; locale separators; copy from config files where the value is quoted or has units.","solutions":["Give a plain integer literal (e.g. gc_grace_seconds = 864000)","Remove units, underscores, commas, or decimals from the value","If a duration is intended, convert it to whole seconds/minutes as required by the option","Check the option's docs for its valid numeric range and type"],"exampleFix":"// before\nALTER TABLE t WITH gc_grace_seconds = 5s;\n// after\nALTER TABLE t WITH gc_grace_seconds = 5;","handlingStrategy":"validation","validationCode":"if (!Number.isInteger(Number(value)) || String(value).trim() !== String(Number(value))) throw new Error(`Invalid integer for ${key}: ${value}`);","typeGuard":"function isPlainInt(v) { return /^-?\\d+$/.test(String(v).trim()); }","tryCatchPattern":"try { runCql(stmt); } catch (e) { if (/Invalid integer value .* for/.test(e.message)) coerceIntProps(stmt); else throw e; }","preventionTips":["Emit integer properties as bare integer literals without units or separators","Convert durations (5s, 5m) to whole numbers before generating CQL","Keep numeric options typed in your schema/config layer, not strings"],"tags":["cql","integer","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"}