{"record":{"id":"089f6975a49cba51","repo":"apache/cassandra","slug":"argument-s-cannot-be-frozen-remove-frozen-mo-089f69","errorCode":null,"errorMessage":"Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'","messagePattern":"Argument '(.+?)' cannot be frozen; remove frozen<> modifier from '(.+?)'","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/cql3/statements/schema/DropAggregateStatement.java","lineNumber":108,"sourceCode":"                return schema;\n\n            throw ire(\"Aggregate '%s' doesn't exist\", name);\n        }\n\n        Collection<UserFunction> aggregates = keyspace.userFunctions.get(new FunctionName(keyspaceName, aggregateName));\n        if (aggregates.size() > 1 && !argumentsSpeficied)\n        {\n            throw ire(\"'DROP AGGREGATE %s' matches multiple function definitions; \" +\n                      \"specify the argument types by issuing a statement like \" +\n                      \"'DROP AGGREGATE %s (type, type, ...)'. You can use cqlsh \" +\n                      \"'DESCRIBE AGGREGATE %s' command to find all overloads\",\n                      aggregateName, aggregateName, aggregateName);\n        }\n\n        arguments.stream()\n                 .filter(raw -> !raw.isImplicitlyFrozen() && raw.isFrozen())\n                 .findFirst()\n                 .ifPresent(t -> { throw ire(\"Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'\", t, t); });\n\n        List<AbstractType<?>> argumentTypes = prepareArgumentTypes(keyspace.types);\n\n        Predicate<UserFunction> filter = UserFunctions.Filter.UDA;\n        if (argumentsSpeficied)\n            filter = filter.and(f -> f.typesMatch(argumentTypes));\n\n        UserFunction aggregate = aggregates.stream().filter(filter).findAny().orElse(null);\n        if (null == aggregate)\n        {\n            if (ifExists)\n                return schema;\n\n            throw ire(\"Aggregate '%s' doesn't exist\", name);\n        }\n\n        return schema.withAddedOrUpdated(keyspace.withSwapped(keyspace.userFunctions.without(aggregate)));\n    }","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/DropAggregateStatement.java#L90-L126","documentation":"UDA argument types must be non-frozen. apply() rejects a DROP AGGREGATE whose declared argument types use the frozen<> modifier, asking the user to drop the qualifier since frozen and non-frozen types are matched equivalently for function arguments.","triggerScenarios":"DROP AGGREGATE agg (frozen<list<int>>) or similar, where the aggregate was declared with non-frozen (or implicitly frozen) collection types.","commonSituations":"Copy-pasting the type expression from CREATE TABLE column definitions, where frozen<> is common; misunderstanding that function signatures don't take frozen<>.","solutions":["Remove frozen<> from each argument type in the DROP statement: use list<int>, map<k,v>, set<T> directly","Match the signature exactly as shown by DESCRIBE AGGREGATE or system_schema.aggregates argument_types"],"exampleFix":"// before\nDROP AGGREGATE sales.agg (frozen<map<text,int>>);\n// after\nDROP AGGREGATE sales.agg (map<text,int>);","handlingStrategy":"validation","validationCode":"const bad = types.find(t => /^frozen<.*>$/i.test(t.trim())); if (bad) throw new Error(`Remove frozen<> from argument '${bad}'`);","typeGuard":null,"tryCatchPattern":"try { session.execute(ddl); } catch (e) { if (e instanceof InvalidQueryError && /cannot be frozen/.test(e.message)) { /* strip frozen<> and retry */ } else throw e; }","preventionTips":["Never copy frozen<> from table column definitions into function/aggregate signatures","Match signatures exactly to system_schema.aggregates argument_types"],"tags":["cql","drop-aggregate","frozen-type","uda"],"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-17T15:17:12.973Z"}