{"record":{"id":"cd34363c8ff6298c","repo":"apache/cassandra","slug":"invalid-boolean-value-s-for-s-positive-values","errorCode":null,"errorMessage":"Invalid boolean value %s for '%s'. Positive values can be '1', 'true' or 'yes'. Negative values can be '0', 'false' or 'no'.","messagePattern":"Invalid boolean value (.+?) for '(.+?)'\\. Positive values can be '1', 'true' or 'yes'\\. Negative values can be '0', 'false' or 'no'\\.","errorType":"validation","errorClass":"SyntaxException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java","lineNumber":136,"sourceCode":"    public boolean getBoolean(String key, boolean defaultValue) throws SyntaxException\n    {\n        String value = getString(key);\n        return value != null ? parseBoolean(key, value) : defaultValue;\n    }\n\n    public static boolean parseBoolean(String key, String value) throws SyntaxException\n    {\n        if (null == value)\n            throw new IllegalArgumentException(\"value argument can't be null\");\n\n        String lowerCasedValue = toLowerCaseLocalized(value);\n\n        if (POSITIVE_PATTERN.matcher(lowerCasedValue).matches())\n            return true;\n        else if (NEGATIVE_PATTERN.matcher(lowerCasedValue).matches())\n            return false;\n\n        throw new SyntaxException(format(\"Invalid boolean value %s for '%s'. \" +\n                                         \"Positive values can be '1', 'true' or 'yes'. \" +\n                                         \"Negative values can be '0', 'false' or 'no'.\",\n                                         value, key));\n    }\n\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        {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/PropertyDefinitions.java#L118-L154","documentation":"PropertyDefinitions.parseBoolean() (via getBoolean) accepts only the token sets '1'/'true'/'yes' (positive) and '0'/'false'/'no' (negative) for boolean-typed CQL properties. Any other string is rejected with a SyntaxException listing the accepted values. This keeps property parsing strict and locale/format independent.","triggerScenarios":"Setting a boolean property in CQL (e.g. WITH speculative_retry = 'TRUE' style mistakes, or compaction/compaction-throughput-table-wait-adjacent boolean options) with a value like 'True' variants not matching the regexes, 'on', 'enabled', 'y', or with stray whitespace/quotes inside the string.","commonSituations":"Users writing 'on'/'off' or 'enabled'/'disabled' out of habit; accidental capital-letter-only handling issues when the value arrives quoted ('true' with literal quotes); tools generating CQL with Python-style True/False literals.","solutions":["Use one of: '1', 'true', 'yes' (or '0', 'false', 'no') for the property value","Remove stray quotes/whitespace from the value (write true, not 'true' or ' true ')","Convert True/False (Python/JSON style) to lowercase true/false when generating CQL","Map on/off or enabled/disabled to true/false before emitting the statement"],"exampleFix":"// before\nALTER TABLE t WITH caching = {'keys': 'ALL', 'rows_per_partition': enabled};\n// after\nALTER TABLE t WITH caching = {'keys': 'ALL', 'rows_per_partition': 'no'};","handlingStrategy":"validation","validationCode":"const v = String(value).trim().toLowerCase(); if (!['1','true','yes','0','false','no'].includes(v)) throw new Error(`Invalid boolean for ${key}: ${value}`);","typeGuard":null,"tryCatchPattern":"try { runCql(stmt); } catch (e) { if (e.message.includes('Invalid boolean value')) fixBooleanLiterals(stmt); else throw e; }","preventionTips":["Only emit true/false/1/0/yes/no (lowercase, unquoted) for boolean CQL properties","Convert language booleans (True/False) with an explicit serializer","Avoid string templates that may include quotes inside property values"],"tags":["cql","boolean","property-parsing"],"backgroundTag":"invalid-config-value","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"}