apache/cassandra · error · InvalidRequestException

Empty value for boolean option ''

Error message

Empty value for boolean option ''

What it means

Thrown by NonTokenizingOptions.validateBoolean when a SAI non-tokenizing analyzer boolean option (case_sensitive, normalize, ascii) is supplied with an empty or null value in the CREATE/ALTER CUSTOM INDEX WITH OPTIONS map. Cassandra rejects it up-front as an InvalidRequestException because a boolean option must be literally 'true' or 'false'.

Source

Thrown at src/java/org/apache/cassandra/index/sai/analyzer/NonTokenizingOptions.java:151

                    break;
                }

                case ASCII:
                {
                    boolean boolValue = validateBoolean(entry.getValue(), ASCII);
                    builder = builder.ascii(boolValue);
                    break;
                }
            }
        }
        return builder.build();
    }

    private static boolean validateBoolean(String value, String option)
    {
        if (Strings.isNullOrEmpty(value))
        {
            throw new InvalidRequestException("Empty value for boolean option '" + option + '\'');
        }

        if (!value.equalsIgnoreCase(Boolean.TRUE.toString()) && !value.equalsIgnoreCase(Boolean.FALSE.toString()))
        {
            throw new InvalidRequestException("Illegal value for boolean option '" + option + "': " + value);
        }

        return Boolean.parseBoolean(value);
    }
}

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Supply an explicit value: {'case_sensitive': 'true'} (or 'false')
  2. Remove the option key entirely to accept the default
  3. If options are built in code, skip entries whose value is null or empty before passing the map
  4. Validate the options map client-side before issuing the CQL statement

Example fix

// before
CREATE CUSTOM INDEX ON ks.tbl (col) USING 'StorageAttachedIndex'
  WITH OPTIONS = {'case_sensitive': ''};
// after
CREATE CUSTOM INDEX ON ks.tbl (col) USING 'StorageAttachedIndex'
  WITH OPTIONS = {'case_sensitive': 'true'};
Defensive patterns

Strategy: validation

Validate before calling

Map<String,String> opts = ...; // entry CQL options
if (opts.containsKey("case_sensitive") && (opts.get("case_sensitive") == null || opts.get("case_sensitive").isEmpty()))
    throw new IllegalArgumentException("case_sensitive requires 'true' or 'false'");

Try / catch

try { session.execute(createIndexCql); }
catch (InvalidRequestException e) {
    if (e.getMessage().startsWith("Empty value for boolean option")) { /* fix option value and retry */ }
    else throw e;
}

Prevention

When it happens

Trigger: Executing CREATE CUSTOM INDEX ... USING 'StorageAttachedIndex' WITH OPTIONS = {'case_sensitive': ''} (or normalize/ascii with an empty string or null value); the options map reaches NonTokenizingOptions.fromMap which calls validateBoolean.

Common situations: Programmatic index-option builders that append a key with an unset/empty value; template-generated CQL where a variable failed to interpolate; hand-edited schema files leaving 'option': '' behind.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/b188a2a4ecdd0141. Report an issue: GitHub.