{"record":{"id":"dbea6eae06881842","repo":"apache/cassandra","slug":"s-is-not-true-or-false-s","errorCode":null,"errorMessage":"%s is not 'true' or 'false' (%s)","messagePattern":"(.+?) is not 'true' or 'false' \\((.+?)\\)","errorType":"validation","errorClass":"ConfigurationException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java","lineNumber":155,"sourceCode":"        try\n        {\n            long expiredCheckFrequency = optionValue == null ? DEFAULT_EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS : Long.parseLong(optionValue);\n            if (expiredCheckFrequency < 0)\n            {\n                throw new ConfigurationException(String.format(\"%s must not be negative, but was %d\", EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY, expiredCheckFrequency));\n             }\n        }\n        catch (NumberFormatException e)\n        {\n            throw new ConfigurationException(String.format(\"%s is not a parsable int (base10) for %s\", optionValue, EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY), e);\n        }\n\n\n        optionValue = options.get(UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_KEY);\n        if (optionValue != null)\n        {\n            if (!(optionValue.equalsIgnoreCase(\"true\") || optionValue.equalsIgnoreCase(\"false\")))\n                throw new ConfigurationException(String.format(\"%s is not 'true' or 'false' (%s)\", UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_KEY, optionValue));\n\n            if (optionValue.equalsIgnoreCase(\"true\") && !UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_ENABLED)\n                throw new ConfigurationException(String.format(\"%s is requested but not allowed, restart cassandra with -D%s=true to allow it\",\n                                                               UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_KEY, ALLOW_UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION.getKey()));\n        }\n\n        uncheckedOptions.remove(COMPACTION_WINDOW_SIZE_KEY);\n        uncheckedOptions.remove(COMPACTION_WINDOW_UNIT_KEY);\n        uncheckedOptions.remove(TIMESTAMP_RESOLUTION_KEY);\n        uncheckedOptions.remove(EXPIRED_SSTABLE_CHECK_FREQUENCY_SECONDS_KEY);\n        uncheckedOptions.remove(UNSAFE_AGGRESSIVE_SSTABLE_EXPIRATION_KEY);\n\n        uncheckedOptions = SizeTieredCompactionStrategyOptions.validateOptions(options, uncheckedOptions);\n\n        return uncheckedOptions;\n    }\n}\n","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/compaction/TimeWindowCompactionStrategyOptions.java#L137-L173","documentation":"The unsafe_aggressive_sstable_expiration TWCS option must be the literal string 'true' or 'false' (case-insensitive). validateOptions throws ConfigurationException for any other value, naming the option key and the offending value.","triggerScenarios":"validateOptions with unsafe_aggressive_sstable_expiration set to anything other than true/false, e.g. '1', '0', 'yes', 'enabled', 'True ' with whitespace, 'on'.","commonSituations":"Using 1/0 or yes/no from other config conventions; tools that serialize booleans as '1'; whitespace introduced by templating.","solutions":["Set the option to 'true' or 'false' exactly","Normalize 1/0 or yes/no booleans in the config generator before applying","Remove the option to use the default (false)","Validate boolean strings client-side before issuing the ALTER/CREATE TABLE"],"exampleFix":"// before\n'unsafe_aggressive_sstable_expiration': '1'\n// after\n'unsafe_aggressive_sstable_expiration': 'true'","handlingStrategy":"validation","validationCode":"if (opts.containsKey(\"unsafe_aggressive_sstable_expiration\")) {\n    String v = opts.get(\"unsafe_aggressive_sstable_expiration\").trim();\n    if (!v.equalsIgnoreCase(\"true\") && !v.equalsIgnoreCase(\"false\"))\n        throw new IllegalArgumentException(\"unsafe_aggressive_sstable_expiration must be 'true' or 'false'\");\n}","typeGuard":"static boolean isBooleanOption(String s) { return \"true\".equalsIgnoreCase(s == null ? null : s.trim()) || \"false\".equalsIgnoreCase(s == null ? null : s.trim()); }","tryCatchPattern":"try {\n    session.execute(alterStmt);\n} catch (RuntimeException e) {\n    if (e.getMessage().contains(\"is not 'true' or 'false'\")) { /* fix value */ }\n    throw e;\n}","preventionTips":["Normalize 1/0, yes/no, on/off to true/false in config generators","Trim whitespace from boolean strings","Keep TWCS option templates with literal 'true'/'false' placeholders"],"tags":["cassandra","configuration","compaction","boolean"],"backgroundTag":"invalid-boolean-option","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"}