{"record":{"id":"16fcd35d0be5641f","repo":"apache/cassandra","slug":"illegal-value-for-boolean-option","errorCode":null,"errorMessage":"Illegal value for boolean option '': ","messagePattern":"Illegal value for boolean option '': ","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sai/analyzer/NonTokenizingOptions.java","lineNumber":156,"sourceCode":"                    boolean boolValue = validateBoolean(entry.getValue(), ASCII);\n                    builder = builder.ascii(boolValue);\n                    break;\n                }\n            }\n        }\n        return builder.build();\n    }\n\n    private static boolean validateBoolean(String value, String option)\n    {\n        if (Strings.isNullOrEmpty(value))\n        {\n            throw new InvalidRequestException(\"Empty value for boolean option '\" + option + '\\'');\n        }\n\n        if (!value.equalsIgnoreCase(Boolean.TRUE.toString()) && !value.equalsIgnoreCase(Boolean.FALSE.toString()))\n        {\n            throw new InvalidRequestException(\"Illegal value for boolean option '\" + option + \"': \" + value);\n        }\n\n        return Boolean.parseBoolean(value);\n    }\n}\n","sourceCodeStart":138,"sourceCodeEnd":162,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/analyzer/NonTokenizingOptions.java#L138-L162","documentation":"Thrown by NonTokenizingOptions.validateBoolean when a SAI non-tokenizing analyzer boolean option (case_sensitive, normalize, ascii) has a non-empty value that is not case-insensitively 'true' or 'false'. Only those two literals are accepted; values like 'yes', '1', or 'TRUE ' fail.","triggerScenarios":"CREATE CUSTOM INDEX ... WITH OPTIONS = {'normalize': 'yes'} or {'ascii': '1'} — any string other than 'true'/'false' (case-insensitive) passed to NonTokenizingOptions.fromMap.","commonSituations":"Users porting from other databases where 'yes'/'no' or 1/0 booleans are accepted; YAML/JSON-ish habits ('on'/'off'); trailing whitespace or quotes left in the CQL string.","solutions":["Change the value to 'true' or 'false' (case-insensitive)","Replace 1/0, yes/no, on/off with their boolean literals","Trim whitespace from the option value","Validate option values against [true, false] before building the CQL"],"exampleFix":"// before\nWITH OPTIONS = {'case_sensitive': 'yes'}\n// after\nWITH OPTIONS = {'case_sensitive': 'false'}","handlingStrategy":"validation","validationCode":"String v = opts.get(\"case_sensitive\");\nif (v != null && !v.equalsIgnoreCase(\"true\") && !v.equalsIgnoreCase(\"false\"))\n    throw new IllegalArgumentException(\"case_sensitive must be 'true' or 'false', got: \" + v);","typeGuard":null,"tryCatchPattern":"try { session.execute(createIndexCql); }\ncatch (InvalidRequestException e) {\n    if (e.getMessage().startsWith(\"Illegal value for boolean option\")) { /* normalize to true/false and retry */ }\n    else throw e;\n}","preventionTips":["Only use the literals true/false for SAI boolean options","Normalize yes/no, 1/0, on/off client-side before building CQL","Trim option values of whitespace"],"tags":["cassandra","cql","sai","index-options","validation"],"backgroundTag":"invalid-argument-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"}