{"record":{"id":"8cdbbbb94b69c455","repo":"apache/cassandra","slug":"s-should-be-either-true-or-false-not-s","errorCode":null,"errorMessage":"'%s' should be either 'true' or 'false', not '%s'","messagePattern":"'(.+?)' should be either 'true' or 'false', not '(.+?)'","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java","lineNumber":491,"sourceCode":"            try\n            {\n                long tombstoneCompactionInterval = Long.parseLong(interval);\n                if (tombstoneCompactionInterval < 0)\n                {\n                    throw new ConfigurationException(String.format(\"%s must be greater than 0, but was %d\", TOMBSTONE_COMPACTION_INTERVAL_OPTION, tombstoneCompactionInterval));\n                }\n            }\n            catch (NumberFormatException e)\n            {\n                throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", interval, TOMBSTONE_COMPACTION_INTERVAL_OPTION), e);\n            }\n        }\n\n        String unchecked = options.get(UNCHECKED_TOMBSTONE_COMPACTION_OPTION);\n        if (unchecked != null)\n        {\n            if (!unchecked.equalsIgnoreCase(\"true\") && !unchecked.equalsIgnoreCase(\"false\"))\n                throw new ConfigurationException(String.format(\"'%s' should be either 'true' or 'false', not '%s'\", UNCHECKED_TOMBSTONE_COMPACTION_OPTION, unchecked));\n        }\n\n        String logAll = options.get(LOG_ALL_OPTION);\n        if (logAll != null)\n        {\n            if (!logAll.equalsIgnoreCase(\"true\") && !logAll.equalsIgnoreCase(\"false\"))\n            {\n                throw new ConfigurationException(String.format(\"'%s' should either be 'true' or 'false', not %s\", LOG_ALL_OPTION, logAll));\n            }\n        }\n\n        String compactionEnabled = options.get(COMPACTION_ENABLED);\n        if (compactionEnabled != null)\n        {\n            if (!compactionEnabled.equalsIgnoreCase(\"true\") && !compactionEnabled.equalsIgnoreCase(\"false\"))\n            {\n                throw new ConfigurationException(String.format(\"enabled should either be 'true' or 'false', not %s\", compactionEnabled));\n            }","sourceCodeStart":473,"sourceCodeEnd":509,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/AbstractCompactionStrategy.java#L473-L509","documentation":"Thrown as a ConfigurationException when the unchecked_tombstone_compaction option is present but its value is not the literal string 'true' or 'false' (case-insensitive). This boolean option forces tombstone compaction regardless of threshold, so Cassandra strictly validates it.","triggerScenarios":"CREATE/ALTER TABLE with {'unchecked_tombstone_compaction': 'yes'}, '1', 'on', or any value other than true/false (any casing).","commonSituations":"Porting YAML/JSON-style boolean conventions ('yes'/'no', '1'/'0') into CQL compaction options, tooling that serializes booleans non-uniformly.","solutions":["Set the option to the exact string 'true' or 'false'.","Remove the option if the default (false) behavior is desired.","Fix generating tools to emit Java-style boolean literals."],"exampleFix":"// before\n{'unchecked_tombstone_compaction': 'yes'}\n// after\n{'unchecked_tombstone_compaction': 'true'}","handlingStrategy":"validation","validationCode":"String v = options.get(\"unchecked_tombstone_compaction\");\nif (v != null && !v.equalsIgnoreCase(\"true\") && !v.equalsIgnoreCase(\"false\")) throw new IllegalArgumentException(\"must be true/false: \" + v);","typeGuard":null,"tryCatchPattern":"try { session.execute(alterCql); } catch (ConfigurationException e) { /* normalize boolean literal and retry */ }","preventionTips":["Emit only Java-style true/false literals for boolean compaction options","Normalize yes/no and 1/0 in tooling before generating CQL","Quote options carefully in cqlsh to avoid stray characters"],"tags":["configuration","compaction","boolean"],"backgroundTag":"invalid-enum-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}