{"record":{"id":"b630ef7a2480ce20","repo":"apache/cassandra","slug":"unsupported-type","errorCode":null,"errorMessage":"Unsupported type: ","messagePattern":"Unsupported type: ","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java","lineNumber":293,"sourceCode":"        }\n\n        Map<String, String> analysisOptions = AbstractAnalyzer.getAnalyzerOptions(options);\n        if (target.left.isPrimaryKeyColumn() && !analysisOptions.isEmpty())\n        {\n            throw new InvalidRequestException(ANALYSIS_ON_KEY_COLUMNS_MESSAGE + new CqlBuilder().append(analysisOptions));\n        }\n\n        IndexTermType indexTermType = IndexTermType.create(target.left, metadata.partitionKeyColumns(), target.right);\n        AbstractAnalyzer.fromOptions(indexTermType, analysisOptions);\n        IndexWriterConfig config = IndexWriterConfig.fromOptions(null, indexTermType, options);\n\n        // If we are indexing map entries we need to validate the subtypes\n        if (indexTermType.isComposite())\n        {\n            for (IndexTermType subType : indexTermType.subTypes())\n            {\n                if (!SUPPORTED_TYPES.contains(subType.asCQL3Type()) && !subType.isFrozen())\n                    throw new InvalidRequestException(\"Unsupported type: \" + subType.asCQL3Type());\n            }\n        }\n        else if (!SUPPORTED_TYPES.contains(indexTermType.asCQL3Type()) && !indexTermType.isFrozen())\n        {\n            throw new InvalidRequestException(\"Unsupported type: \" + indexTermType.asCQL3Type());\n        }\n        // If this is a vector type we need to validate it for the current vector index constraints\n        else if (indexTermType.isVector())\n        {\n            if (!(indexTermType.vectorElementType() instanceof FloatType))\n                throw new InvalidRequestException(VECTOR_NON_FLOAT_ERROR);\n\n            if (indexTermType.vectorDimension() == 1 && config.getSimilarityFunction() == VectorSimilarityFunction.COSINE)\n                throw new InvalidRequestException(VECTOR_1_DIMENSION_COSINE_ERROR);\n\n            if (DatabaseDescriptor.getRawConfig().data_file_directories.length > 1)\n                throw new InvalidRequestException(VECTOR_MULTIPLE_DATA_DIRECTORY_ERROR);\n","sourceCodeStart":275,"sourceCodeEnd":311,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/index/sai/StorageAttachedIndex.java#L275-L311","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the SAI supported-type list and choose a supported column type.","Freeze the collection column (frozen types bypass this check) if exact matching on a frozen value is acceptable.","Use a different index implementation (e.g., legacy secondary indexes) or model the data as a supported type.","For map targets, verify both key and value subtypes are supported before creating the index."],"exampleFix":"// before\nCREATE CUSTOM INDEX ON ks.tbl (duration_col) USING 'StorageAttachedIndex';\n// after -- freeze or drop the unsupported target\nCREATE CUSTOM INDEX ON ks.tbl (frozen_list_col) USING 'StorageAttachedIndex';","handlingStrategy":"validation","validationCode":"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);","typeGuard":null,"tryCatchPattern":"catch (InvalidRequestException e) { if (e.getMessage().startsWith(\"Unsupported type:\")) { // fall back to legacy secondary index or fix schema } }","preventionTips":["Check SAI supported types per Cassandra version before indexing","Freeze collections intended for whole-value matching","Avoid duration and exotic custom types as index targets"],"tags":["cassandra","sai","unsupported-type","schema"],"backgroundTag":"unsupported-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}