apache/cassandra · error · InvalidRequestException
Unable to find masking function for
Error message
Unable to find masking function for %s, no declared function matches the signature %s
What it means
Thrown by ColumnMask.findMaskingFunction when a MASKED WITH function reference cannot be resolved to any declared function matching the given name and argument types. FunctionResolver.get returned null, meaning no native or user-defined function exists with that signature. Cassandra refuses to attach the masking policy because there is no function to apply.
Solutions
- Verify the exact masking function name and argument signature against the built-ins in org.apache.cassandra.cql3.functions.masking (MaskingFunction, HashMaskingFunction, etc.) and fix the MASKED WITH clause.
- Qualify the function with its keyspace (keyspace.funcName) if it is a user-defined masking function and check it exists via SELECT from system_schema.functions.
- Confirm the argument count and types match a declared overload; use DESCRIBE FUNCTION or cqlsh to inspect available signatures.
Example fix
// before CREATE TABLE users (email text MASKED WITH bogus_mask(text)); // after CREATE TABLE users (email text MASKED WITH mask_null(text));
Defensive patterns
Strategy: validation
Validate before calling
// check function exists before DDL
Row r = session.execute("SELECT function_name FROM system_schema.functions WHERE keyspace_name=? AND function_name=?", ks, fn).one();
if (r == null) throw new IllegalStateException("masking function not found: " + fn); Prevention
- Keep a checked-in list of approved masking function signatures per column type.
- Always fully-qualify UDF masking functions with the keyspace.
- Test masked-column DDL in a staging keyspace before production.
When it happens
Trigger: Executing CREATE TABLE ... col type MASKED WITH <name>(args) or ALTER TABLE ... MASKED WITH, where the function name is misspelled, the function does not exist in the keyspace, or the argument types/count do not match any declared overload.
Common situations: Typo in the masking function name (e.g. mask_null vs mask_null()), referencing a UDF that was created in a different keyspace without qualification, passing wrong argument arity to a built-in masking function, or running against a cluster where dynamic data masking (CE-3.0 feature) functions are unavailable.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Aggregate function cannot be used for masking table columns
- Ambiguous call to function
- appendAll() can only be called on non-frozen collections
- Function ' ' is still referenced by column masks in tables
- Invalid call to function
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/36e250eef18d4cde.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/functions/masking/ColumnMask.java:245
}
public ColumnMask prepare(String keyspace, String table, ColumnIdentifier column, AbstractType<?> type, UserFunctions functions)
{
ScalarFunction function = findMaskingFunction(keyspace, table, column, type, functions);
ByteBuffer[] partialArguments = preparePartialArguments(keyspace, function);
return new ColumnMask(function, partialArguments);
}
private ScalarFunction findMaskingFunction(String keyspace, String table, ColumnIdentifier column, AbstractType<?> type, UserFunctions functions)
{
List<AssignmentTestable> args = new ArrayList<>(rawPartialArguments.size() + 1);
args.add(type);
args.addAll(rawPartialArguments);
Function function = FunctionResolver.get(keyspace, name, args, keyspace, table, type, functions);
if (function == null)
throw invalidRequest("Unable to find masking function for %s, " +
"no declared function matches the signature %s",
column, this);
if (function.isAggregate())
throw invalidRequest("Aggregate function %s cannot be used for masking table columns", this);
if (function.isNative() && !(function instanceof MaskingFunction))
throw invalidRequest("Not-masking function %s cannot be used for masking table columns", this);
if (!function.isNative() && !function.name().keyspace.equals(keyspace))
throw invalidRequest("Masking function %s doesn't belong to the same keyspace as the table %s.%s",
this, keyspace, table);
CQL3Type returnType = function.returnType().asCQL3Type();
CQL3Type expectedType = type.asCQL3Type();
if (!returnType.equals(expectedType))
throw invalidRequest("Masking function %s return type is %s. " +
"This is different to the type of the masked column %s of type %s. " +View on GitHub (pinned to 88fd0f6a0e)