apache/cassandra · error · InvalidRequestException

CQL type

Error message

CQL type 

What it means

AbstractAnalyzer.fromOptions only supports analyzers on text-like CQL types. When analyzer options (or a non-tokenizing analyzer) are supplied for a CQL type that cannot be analyzed (e.g., int, uuid, collections), it throws InvalidRequestException 'CQL type <type> cannot be analyzed.'

Source

Thrown at src/java/org/apache/cassandra/index/sai/analyzer/AbstractAnalyzer.java:97

        default void close()
        {
        }
    }

    public static AnalyzerFactory fromOptions(IndexTermType indexTermType, Map<String, String> options)
    {
        if (hasNonTokenizingOptions(options))
        {
            if (indexTermType.isString())
            {
                // validate options
                NonTokenizingOptions.fromMap(options);
                return () -> new NonTokenizingAnalyzer(indexTermType, options);
            }
            else
            {
                throw new InvalidRequestException("CQL type " + indexTermType.asCQL3Type() + " cannot be analyzed.");
            }
        }

        return null;
    }

    private static boolean hasNonTokenizingOptions(Map<String, String> options)
    {
        return options.keySet().stream().anyMatch(NonTokenizingOptions::hasOption);
    }

    public static Map<String, String> getAnalyzerOptions(Map<String, String> options)
    {
        return options.entrySet().stream()
                      .filter(e -> NonTokenizingOptions.hasOption(e.getKey()))
                      .collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Remove analyzer options from the index on the non-text column.
  2. Only apply NonTokenizingOptions/analyzer options to text and ascii columns.
  3. Verify the target column in the CREATE INDEX statement is the intended text column.

Example fix

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

Strategy: validation

Validate before calling

const ANALYZABLE = new Set(['text','ascii']); if (Object.keys(options).some(k => ['analyzer_class','case_sensitive','normalize_upper','normalize_lower'].includes(k)) && !ANALYZABLE.has(columnType)) throw new Error(`CQL type ${columnType} cannot be analyzed`);

Try / catch

catch (InvalidRequestException e) { if (e.getMessage().includes('cannot be analyzed')) { // retry without analyzer options } }

Prevention

When it happens

Trigger: CREATE CUSTOM INDEX ... WITH OPTIONS containing analyzer keys (e.g., 'analyzer_class', 'case_sensitive', normalization/tokenizer options) on a non-text column such as int, timestamp, uuid, or frozen collections.

Common situations: Copying index DDL from a text column to a numeric/UUID column; generic tooling that appends analyzer options to every SAI index; typo making the target resolve to the wrong column.

Related errors


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