{"record":{"id":"7ffd156e9727047d","repo":"apache/cassandra","slug":"frozen-is-only-allowed-on-collections-tuples-a","errorCode":null,"errorMessage":"frozen<> is only allowed on collections, tuples, and user-defined types (got %s)","messagePattern":"frozen<> is only allowed on collections, tuples, and user-defined types \\(got (.+?)\\)","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/CQL3Type.java","lineNumber":687,"sourceCode":"        public boolean isImplicitlyFrozen()\n        {\n            return isTuple() || isVector();\n        }\n\n        public boolean isVector()\n        {\n            return false;\n        }\n\n        public String keyspace()\n        {\n            return null;\n        }\n\n        public Raw freeze()\n        {\n            String message = String.format(\"frozen<> is only allowed on collections, tuples, and user-defined types (got %s)\", this);\n            throw new InvalidRequestException(message);\n        }\n\n        public abstract void validate(ClientState state, String name);\n\n        public CQL3Type prepare(String keyspace)\n        {\n            KeyspaceMetadata ksm = Schema.instance.getKeyspaceMetadata(keyspace);\n            if (ksm == null)\n                throw new ConfigurationException(String.format(\"Keyspace %s doesn't exist\", keyspace));\n            return prepare(keyspace, ksm.types);\n        }\n\n        public abstract CQL3Type prepare(String keyspace, Types udts) throws InvalidRequestException;\n\n        public CQL3Type prepareInternal(String keyspace, Types udts) throws InvalidRequestException\n        {\n            return prepare(keyspace, udts);\n        }","sourceCodeStart":669,"sourceCodeEnd":705,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/CQL3Type.java#L669-L705","documentation":"In CQL3Type.Raw (the parsed, not-yet-prepared type), freeze() is meant only for collections, tuples, and UDTs which support frozen semantics. Calling frozen<> on any other type (e.g. int, text, uuid) throws InvalidRequestException because freezing a scalar is meaningless — frozen controls whether the type's internal structure can be updated after being stored in a collection/UDT cell.","triggerScenarios":"A CQL statement like CREATE TABLE t (k int PRIMARY KEY, v frozen<int>); or frozen<text>; — applying frozen<> to a non-collection type in a schema definition.","commonSituations":"Copy-paste schema edits adding frozen<> indiscriminately; misunderstanding that frozen applies to all types; migration scripts generated from schemas of other databases.","solutions":["Remove frozen<> from the non-collection type: use plain int, text, etc.","Apply frozen<> only to collections (list/set/map), tuples, and UDTs","If you intended multi-cell behavior for a collection, use frozen<list<int>>-style only where required by the schema design"],"exampleFix":"// before\nCREATE TABLE t (k int PRIMARY KEY, v frozen<int>);\n// after\nCREATE TABLE t (k int PRIMARY KEY, v int);","handlingStrategy":"validation","validationCode":"// client-side check before DDL\nboolean freezable = type instanceof CollectionType || type instanceof TupleType || type instanceof UserType;\nif (!freezable) throw new InvalidRequestException(\"frozen<> not allowed on \" + type);","typeGuard":null,"tryCatchPattern":"try { session.execute(schemaDdl); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"frozen\")) fixDdlAndRetry(); }","preventionTips":["Only use frozen<> with list/set/map, tuple, and UDT types","Review generated DDL scripts for stray frozen<> wrappers","Remember frozen only matters for types with internal structure"],"tags":["cassandra","cql","schema","frozen","ddl"],"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"}