{"record":{"id":"5c56f0a1586759c5","repo":"apache/cassandra","slug":"cannot-create-s-index-on-frozen-column-s-froz","errorCode":null,"errorMessage":"Cannot create %s() index on frozen column %s. Frozen collections are immutable and must be fully indexed by using the 'full(%s)' modifier","messagePattern":"Cannot create (.+?)\\(\\) index on frozen column (.+?)\\. Frozen collections are immutable and must be fully indexed by using the 'full\\((.+?)\\)' modifier","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java","lineNumber":302,"sourceCode":"            if (compactTable.compactValueColumn.equals(column))\n                throw new InvalidRequestException(COMPACT_COLUMN_IN_COMPACT_STORAGE);\n        }\n\n        if (column.isPartitionKey() && table.partitionKeyColumns().size() == 1)\n            throw ire(ONLY_PARTITION_KEY, column);\n\n        if (target.type == Type.FULL && isNonSAIIndex && (!baseType.isCollection() || column.type.isMultiCell()))\n            throw ire(FULL_ON_FROZEN_COLLECTIONS);\n\n        if (!baseType.isCollection() && target.type != Type.SIMPLE)\n            throw ire(NON_COLLECTION_SIMPLE_INDEX, target.type, column);\n\n        // Frozen collections are only supported with SAI indexes.\n        if (isNonSAIIndex && baseType.isCollection() && !column.type.isMultiCell())\n        {\n            if (target.type == Type.VALUES || target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES)\n            {\n                throw ire(CREATE_ON_FROZEN_COLUMN, target.type.toString(), column.name, column.name);\n            }\n        }\n\n        if (!(baseType instanceof MapType) && (target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES ))\n            throw ire(CREATE_WITH_NON_MAP_TYPE, target.type, column);\n\n        // Can't query map[key]=value on clustering key columns, so ENTRIES index would be not queryable.\n        if (column.isClusteringColumn() && baseType instanceof MapType && !column.type.isMultiCell()\n            && target.type == Type.KEYS_AND_VALUES)\n            throw ire(ENTRIES_INDEX_ON_FROZEN_MAP_CLUSTERING_KEY_NOT_SUPPORTED, column.name);\n\n        if (column.type.isUDT() && column.type.isMultiCell())\n            throw ire(CREATE_ON_NON_FROZEN_UDT, column);\n    }\n\n    /**\n     * Checks if the given index attributes represent a Storage Attached Index.\n     */","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java#L284-L320","documentation":"Non-SAI indexes cannot use VALUES/KEYS/KEYS_AND_VALUES on frozen collections. Frozen collections are immutable single-cell blobs, so per-element indexing is impossible; a frozen collection must be indexed atomically with full(). Raised in validateIndexTarget when a non-SAI index targets a frozen collection (multiCell == false) with VALUES/KEYS/KEYS_AND_VALUES.","triggerScenarios":"`CREATE INDEX ON t (values(frozen_list_col))` or keys(...)/entries(...) where the column is declared frozen<list<...>>/frozen<set<...>>/frozen<map<...>> and the index is a legacy (non-SAI) index.","commonSituations":"Migrating tables from non-frozen to frozen collections for existing index DDL reuse; mixing SAI examples (which differ) with legacy index syntax.","solutions":["Use full(col) instead: CREATE INDEX idx ON t (full(frozen_col)).","Remove the frozen modifier on the collection so per-element indexing works (recreate the table).","Use SAI, which supports different combinations of frozen collections."],"exampleFix":"// before\nCREATE INDEX ON t (values(tags)); // tags frozen<set<text>>\n// after\nCREATE INDEX ON t (full(tags));","handlingStrategy":"validation","validationCode":"if (isNonSaiIndex && baseType.isCollection() && !column.type.isMultiCell() && ['VALUES','KEYS','KEYS_AND_VALUES'].includes(target.type)) throw new Error('frozen collections need full() for non-SAI indexes');","typeGuard":"const frozenNeedsFull = (t, sai, targetType) => !sai && t.isCollection() && !t.isMultiCell() && targetType !== 'FULL';","tryCatchPattern":"try { session.execute(ddl); } catch (e) { if (/Frozen collections are immutable and must be fully indexed/.test(e.message)) { /* switch to full(col) */ } else throw e; }","preventionTips":["Pair frozen collection columns exclusively with full()","Keep SAI and legacy index DDL in separate templates"],"tags":["cassandra","cql","secondary-index","frozen","collections"],"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"}