apache/cassandra · error · InvalidRequestException

Unsupported type:

Error message

Unsupported type: 

What it means

SAI only supports indexing a fixed set of CQL types. When the index target type (or, for composite targets like map entries, each subtype) is not in SUPPORTED_TYPES and is not frozen, validateOptions throws this InvalidRequestException naming the unsupported CQL3 type.

Source

Thrown at src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java:293

        }

        Map<String, String> analysisOptions = AbstractAnalyzer.getAnalyzerOptions(options);
        if (target.left.isPrimaryKeyColumn() && !analysisOptions.isEmpty())
        {
            throw new InvalidRequestException(ANALYSIS_ON_KEY_COLUMNS_MESSAGE + new CqlBuilder().append(analysisOptions));
        }

        IndexTermType indexTermType = IndexTermType.create(target.left, metadata.partitionKeyColumns(), target.right);
        AbstractAnalyzer.fromOptions(indexTermType, analysisOptions);
        IndexWriterConfig config = IndexWriterConfig.fromOptions(null, indexTermType, options);

        // If we are indexing map entries we need to validate the subtypes
        if (indexTermType.isComposite())
        {
            for (IndexTermType subType : indexTermType.subTypes())
            {
                if (!SUPPORTED_TYPES.contains(subType.asCQL3Type()) && !subType.isFrozen())
                    throw new InvalidRequestException("Unsupported type: " + subType.asCQL3Type());
            }
        }
        else if (!SUPPORTED_TYPES.contains(indexTermType.asCQL3Type()) && !indexTermType.isFrozen())
        {
            throw new InvalidRequestException("Unsupported type: " + indexTermType.asCQL3Type());
        }
        // If this is a vector type we need to validate it for the current vector index constraints
        else if (indexTermType.isVector())
        {
            if (!(indexTermType.vectorElementType() instanceof FloatType))
                throw new InvalidRequestException(VECTOR_NON_FLOAT_ERROR);

            if (indexTermType.vectorDimension() == 1 && config.getSimilarityFunction() == VectorSimilarityFunction.COSINE)
                throw new InvalidRequestException(VECTOR_1_DIMENSION_COSINE_ERROR);

            if (DatabaseDescriptor.getRawConfig().data_file_directories.length > 1)
                throw new InvalidRequestException(VECTOR_MULTIPLE_DATA_DIRECTORY_ERROR);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Check the SAI supported-type list and choose a supported column type.
  2. Freeze the collection column (frozen types bypass this check) if exact matching on a frozen value is acceptable.
  3. Use a different index implementation (e.g., legacy secondary indexes) or model the data as a supported type.
  4. For map targets, verify both key and value subtypes are supported before creating the index.

Example fix

// before
CREATE CUSTOM INDEX ON ks.tbl (duration_col) USING 'StorageAttachedIndex';
// after -- freeze or drop the unsupported target
CREATE CUSTOM INDEX ON ks.tbl (frozen_list_col) USING 'StorageAttachedIndex';
Defensive patterns

Strategy: validation

Validate before calling

const SAI_SUPPORTED = new Set(['text','ascii','string-like','int','bigint','smallint','tinyint','varint','decimal','float','double','date','timestamp','time','uuid','boolean','inet','vector', ...]); if (!SAI_SUPPORTED.has(columnType) && !columnType.startsWith('frozen<')) throw new Error('type not SAI-indexable: ' + columnType);

Try / catch

catch (InvalidRequestException e) { if (e.getMessage().startsWith("Unsupported type:")) { // fall back to legacy secondary index or fix schema } }

Prevention

When it happens

Trigger: CREATE CUSTOM INDEX ... USING 'StorageAttachedIndex' on a column whose type is not in SUPPORTED_TYPES (e.g., duration, non-frozen collections, custom types), or on a composite (map entry/collection) target whose element/key/value subtype is unsupported.

Common situations: Trying to SAI-index a duration or non-frozen list/set/map column; indexing map entries where the map value type is unsupported; upgrading and attempting indexes on types SAI never supported.

Related errors


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