{"record":{"id":"5c31fcae2f9a2dae","repo":"apache/cassandra","slug":"argument-s-cannot-be-frozen-remove-frozen-mo-5c31fc","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/CreateFunctionStatement.java","lineNumber":111,"sourceCode":"\n    // TODO: replace affected aggregates !!\n    public Keyspaces apply(ClusterMetadata metadata)\n    {\n        if (ifNotExists && orReplace)\n            throw ire(\"Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives\");\n\n        UDFunction.assertUdfsEnabled(language);\n\n        if (!FunctionName.isNameValid(functionName))\n            throw ire(\"Function name '%s' is invalid\", functionName);\n\n        if (new HashSet<>(argumentNames).size() != argumentNames.size())\n            throw ire(\"Duplicate argument names for given function %s with argument names %s\", functionName, argumentNames);\n\n        rawArgumentTypes.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        if (!rawReturnType.isImplicitlyFrozen() && rawReturnType.isFrozen())\n            throw ire(\"Return type '%s' cannot be frozen; remove frozen<> modifier from '%s'\", rawReturnType, rawReturnType);\n\n        Keyspaces schema = metadata.schema.getKeyspaces();\n        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);\n        if (null == keyspace)\n            throw ire(\"Keyspace '%s' doesn't exist\", keyspaceName);\n\n        List<AbstractType<?>> argumentTypes =\n            rawArgumentTypes.stream()\n                            .map(t -> t.prepare(keyspaceName, keyspace.types).getType().udfType())\n                            .collect(toList());\n        AbstractType<?> returnType = rawReturnType.prepare(keyspaceName, keyspace.types).getType().udfType();\n\n        UDFunction function =\n            UDFunction.create(new FunctionName(keyspaceName, functionName),\n                              argumentNames,","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/cql3/statements/schema/CreateFunctionStatement.java#L93-L129","documentation":"A CREATE FUNCTION statement declared a frozen< > argument type, which Cassandra rejects for user-defined functions. UDF argument types must be non-frozen (UDFType wrappers are applied internally); the check filters raw types that are explicitly frozen and not implicitly frozen.","triggerScenarios":"CREATE FUNCTION with an argument declared as frozen<udt> or frozen<list<...>>, e.g. CREATE FUNCTION f(x frozen<address>) ...","commonSituations":"Copy-pasting column type definitions (which often use frozen UDTs) into a function signature; misunderstanding when frozen<> is needed in table schemas versus functions.","solutions":["Remove the frozen<> modifier from the function argument type","Declare the UDT argument without frozen, e.g. use the UDT name directly","Only keep frozen<> in table column definitions where required"],"exampleFix":"// before\nCREATE FUNCTION ks.dist(x frozen<address>) ...\n// after\nCREATE FUNCTION ks.dist(x address) ...","handlingStrategy":"validation","validationCode":"boolean argsFrozen = rawArgumentTypes.stream().anyMatch(t -> !t.isImplicitlyFrozen() && t.isFrozen());\nif (argsFrozen) throw new IllegalArgumentException(\"Remove frozen<> from function arguments\");","typeGuard":"boolean isFrozenArg(CQLType raw) { return !raw.isImplicitlyFrozen() && raw.isFrozen(); }","tryCatchPattern":"try { session.execute(stmt); } catch (InvalidRequestException e) { if (e.getMessage().contains(\"cannot be frozen\")) { /* strip frozen<> and retry */ } else throw e; }","preventionTips":["Never copy frozen<> column types into UDF signatures","Remember UDF args/returns are never frozen","Validate generated DDL against a frozen-type regex before applying"],"tags":["cql","udf","frozen","validation"],"backgroundTag":"schema-validation-failed","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"}