apache/cassandra · error · InvalidRequestException

Cannot create %s() index on frozen column %s. Frozen collect

Error message

Cannot create %s() index on frozen column %s. Frozen collections are immutable and must be fully indexed by using the 'full(%s)' modifier

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java:302

            if (compactTable.compactValueColumn.equals(column))
                throw new InvalidRequestException(COMPACT_COLUMN_IN_COMPACT_STORAGE);
        }

        if (column.isPartitionKey() && table.partitionKeyColumns().size() == 1)
            throw ire(ONLY_PARTITION_KEY, column);

        if (target.type == Type.FULL && isNonSAIIndex && (!baseType.isCollection() || column.type.isMultiCell()))
            throw ire(FULL_ON_FROZEN_COLLECTIONS);

        if (!baseType.isCollection() && target.type != Type.SIMPLE)
            throw ire(NON_COLLECTION_SIMPLE_INDEX, target.type, column);

        // Frozen collections are only supported with SAI indexes.
        if (isNonSAIIndex && baseType.isCollection() && !column.type.isMultiCell())
        {
            if (target.type == Type.VALUES || target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES)
            {
                throw ire(CREATE_ON_FROZEN_COLUMN, target.type.toString(), column.name, column.name);
            }
        }

        if (!(baseType instanceof MapType) && (target.type == Type.KEYS || target.type == Type.KEYS_AND_VALUES ))
            throw ire(CREATE_WITH_NON_MAP_TYPE, target.type, column);

        // Can't query map[key]=value on clustering key columns, so ENTRIES index would be not queryable.
        if (column.isClusteringColumn() && baseType instanceof MapType && !column.type.isMultiCell()
            && target.type == Type.KEYS_AND_VALUES)
            throw ire(ENTRIES_INDEX_ON_FROZEN_MAP_CLUSTERING_KEY_NOT_SUPPORTED, column.name);

        if (column.type.isUDT() && column.type.isMultiCell())
            throw ire(CREATE_ON_NON_FROZEN_UDT, column);
    }

    /**
     * Checks if the given index attributes represent a Storage Attached Index.
     */

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Use full(col) instead: CREATE INDEX idx ON t (full(frozen_col)).
  2. Remove the frozen modifier on the collection so per-element indexing works (recreate the table).
  3. Use SAI, which supports different combinations of frozen collections.

Example fix

// before
CREATE INDEX ON t (values(tags)); // tags frozen<set<text>>
// after
CREATE INDEX ON t (full(tags));
Defensive patterns

Strategy: validation

Validate before calling

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');

Type guard

const frozenNeedsFull = (t, sai, targetType) => !sai && t.isCollection() && !t.isMultiCell() && targetType !== 'FULL';

Try / catch

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; }

Prevention

When it happens

Trigger: `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.

Common situations: Migrating tables from non-frozen to frozen collections for existing index DDL reuse; mixing SAI examples (which differ) with legacy index syntax.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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