apache/cassandra · error · InvalidRequestException

Argument ' ' cannot be frozen; remove frozen<> modifier from

Error message

Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'

What it means

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.

Solutions

  1. Remove the frozen<> modifier from the function argument type
  2. Declare the UDT argument without frozen, e.g. use the UDT name directly
  3. Only keep frozen<> in table column definitions where required

Example fix

// before
CREATE FUNCTION ks.dist(x frozen<address>) ...
// after
CREATE FUNCTION ks.dist(x address) ...
Defensive patterns

Strategy: validation

Validate before calling

boolean argsFrozen = rawArgumentTypes.stream().anyMatch(t -> !t.isImplicitlyFrozen() && t.isFrozen());
if (argsFrozen) throw new IllegalArgumentException("Remove frozen<> from function arguments");

Type guard

boolean isFrozenArg(CQLType raw) { return !raw.isImplicitlyFrozen() && raw.isFrozen(); }

Try / catch

try { session.execute(stmt); } catch (InvalidRequestException e) { if (e.getMessage().contains("cannot be frozen")) { /* strip frozen<> and retry */ } else throw e; }

Prevention

When it happens

Trigger: CREATE FUNCTION with an argument declared as frozen<udt> or frozen<list<...>>, e.g. CREATE FUNCTION f(x frozen<address>) ...

Common situations: Copy-pasting column type definitions (which often use frozen UDTs) into a function signature; misunderstanding when frozen<> is needed in table schemas versus functions.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateFunctionStatement.java:111

    // TODO: replace affected aggregates !!
    public Keyspaces apply(ClusterMetadata metadata)
    {
        if (ifNotExists && orReplace)
            throw ire("Cannot use both 'OR REPLACE' and 'IF NOT EXISTS' directives");

        UDFunction.assertUdfsEnabled(language);

        if (!FunctionName.isNameValid(functionName))
            throw ire("Function name '%s' is invalid", functionName);

        if (new HashSet<>(argumentNames).size() != argumentNames.size())
            throw ire("Duplicate argument names for given function %s with argument names %s", functionName, argumentNames);

        rawArgumentTypes.stream()
                        .filter(raw -> !raw.isImplicitlyFrozen() && raw.isFrozen())
                        .findFirst()
                        .ifPresent(t -> { throw ire("Argument '%s' cannot be frozen; remove frozen<> modifier from '%s'", t, t); });

        if (!rawReturnType.isImplicitlyFrozen() && rawReturnType.isFrozen())
            throw ire("Return type '%s' cannot be frozen; remove frozen<> modifier from '%s'", rawReturnType, rawReturnType);

        Keyspaces schema = metadata.schema.getKeyspaces();
        KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
        if (null == keyspace)
            throw ire("Keyspace '%s' doesn't exist", keyspaceName);

        List<AbstractType<?>> argumentTypes =
            rawArgumentTypes.stream()
                            .map(t -> t.prepare(keyspaceName, keyspace.types).getType().udfType())
                            .collect(toList());
        AbstractType<?> returnType = rawReturnType.prepare(keyspaceName, keyspace.types).getType().udfType();

        UDFunction function =
            UDFunction.create(new FunctionName(keyspaceName, functionName),
                              argumentNames,

View on GitHub (pinned to 88fd0f6a0e)