{"record":{"id":"303e96d35ad70f21","repo":"apache/cassandra","slug":"invalid-value-for-property-s-it-must-be-a-bool","errorCode":null,"errorMessage":"Invalid value for property '%s'. It must be a boolean","messagePattern":"Invalid value for property '(.+?)'\\. It must be a boolean","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/auth/RoleOptions.java","lineNumber":148,"sourceCode":"     * during validation of CQL statements, so the IRE results in a error response to the client.\n     *\n     * @throws InvalidRequestException if any options which are not supported by the configured IRoleManager\n     *     are set or if any option value is of an incorrect type.\n     */\n    public void validate()\n    {\n        for (Map.Entry<IRoleManager.Option, Object> option : options.entrySet())\n        {\n            if (!DatabaseDescriptor.getRoleManager().supportedOptions().contains(option.getKey()))\n                throw new InvalidRequestException(String.format(\"%s doesn't support %s\",\n                                                                DatabaseDescriptor.getRoleManager().getClass().getName(),\n                                                                option.getKey()));\n            switch (option.getKey())\n            {\n                case LOGIN:\n                case SUPERUSER:\n                    if (!(option.getValue() instanceof Boolean))\n                        throw new InvalidRequestException(String.format(\"Invalid value for property '%s'. \" +\n                                                                        \"It must be a boolean\",\n                                                                        option.getKey()));\n                    break;\n                case PASSWORD:\n                    if (!(option.getValue() instanceof String))\n                        throw new InvalidRequestException(String.format(\"Invalid value for property '%s'. \" +\n                                                                        \"It must be a string\",\n                                                                        option.getKey()));\n                    if (options.containsKey(IRoleManager.Option.HASHED_PASSWORD))\n                        throw new InvalidRequestException(String.format(\"Properties '%s' and '%s' are mutually exclusive\",\n                                                                        IRoleManager.Option.PASSWORD, IRoleManager.Option.HASHED_PASSWORD));\n                    break;\n                case HASHED_PASSWORD:\n                    if (!(option.getValue() instanceof String))\n                        throw new InvalidRequestException(String.format(\"Invalid value for property '%s'. \" +\n                                                                        \"It must be a string\",\n                                                                        option.getKey()));\n                    if (options.containsKey(IRoleManager.Option.PASSWORD))","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/auth/RoleOptions.java#L130-L166","documentation":"In RoleOptions.validate(), the LOGIN and SUPERUSER options must be Boolean literals. Because CQL parses option values as terms, a quoted or untyped value (e.g. 'true' as a string) arrives as a non-Boolean, and an InvalidRequestException is thrown telling the user the property must be a boolean.","triggerScenarios":"CREATE ROLE/ALTER ROLE with LOGIN='true' or SUPERUSER=1 — value parsed as string/integer instead of the boolean literal true/false.","commonSituations":"Scripts generated from other systems quote boolean values; users migrating from SQL habits write 0/1 or 'true'; templating tools stringify values.","solutions":["Use unquoted CQL boolean literals: LOGIN = true, SUPERUSER = false.","Fix the client driver/schema so boolean params are sent as boolean terms not strings.","Regenerate templated statements so booleans are not quoted."],"exampleFix":"// before\nCREATE ROLE alice WITH LOGIN = 'true';\n// after\nCREATE ROLE alice WITH LOGIN = true;","handlingStrategy":"validation","validationCode":"Object v = roleOptions.get(IRoleManager.Option.LOGIN);\nif (v != null && !(v instanceof Boolean))\n    throw new IllegalArgumentException(\"LOGIN must be a boolean literal (true/false), not quoted\");","typeGuard":"boolean isBooleanOption(Object v) { return v instanceof Boolean; }","tryCatchPattern":"try {\n    session.execute(\"CREATE ROLE alice WITH LOGIN = ?\", true);\n} catch (InvalidRequestException e) {\n    if (e.getMessage().contains(\"It must be a boolean\")) {\n        // resend with unquoted boolean literal\n    }\n}","preventionTips":["Never quote boolean literals in CQL role statements.","Bind Boolean-typed parameters via drivers.","Review templated scripts for stringified booleans."],"tags":["cassandra","auth","roles","type-error"],"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"}