apache/cassandra · error · InvalidRequestException
User-defined functions are disabled in cassandra.yaml - set…
Error message
User-defined functions are disabled in cassandra.yaml - set user_defined_functions_enabled=true to enable
What it means
UDFunction.assertUdfsEnabled rejects UDF creation/execution when user_defined_functions_enabled is false in cassandra.yaml (DatabaseDescriptor.enableUserDefinedFunctions() returns false). Cassandra disables Java UDFs by default for security and sandboxing reasons.
Solutions
- Set user_defined_functions_enabled: true in cassandra.yaml and restart the node(s)
- If UDFs are intentionally disabled, remove/avoid the UDF calls from queries and schema
- Check the effective value via a config dump/nodtool to confirm the setting applied to all nodes
Example fix
// cassandra.yaml // before user_defined_functions_enabled: false // after user_defined_functions_enabled: true
Defensive patterns
Strategy: validation
Validate before calling
// before using UDFs, check the effective config
boolean udfsOn = DatabaseDescriptor.enableUserDefinedFunctions();
if (!udfsOn) throw new IllegalStateException("enable user_defined_functions_enabled in cassandra.yaml first"); Try / catch
try { session.execute("SELECT f(x) FROM t ..."); } catch (InvalidRequestException e) { if (e.getMessage().contains("disabled")) { /* guide operator to set user_defined_functions_enabled=true */ } throw e; } Prevention
- Set user_defined_functions_enabled: true in cassandra.yaml on every node before deploying UDFs
- Restart nodes after changing the config so DatabaseDescriptor picks it up
- Document the flag in cluster runbooks; it is disabled by default
When it happens
Trigger: CREATE FUNCTION / CREATE AGGREGATE, or executing a query that invokes a UDF (execute, executeForAggregate), while user_defined_functions_enabled is not set to true in cassandra.yaml.
Common situations: Fresh install or upgrade where UDFs are disabled by default; cluster where the operator deliberately disabled UDFs; calling a UDF created on a cluster where the flag was later turned off.
Related errors
- accord.journal_directory must be specified
- Allowing java.lang.System.* access in UDFs is dangerous and…
- Async Profiler is not enabled. Enable it by setting
- At least one DataFileDirectory must be specified
- Auto-repair scheduler is disabled.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/185de8e2f494ca89.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/functions/UDFunction.java:440
return result;
}
catch (InvalidRequestException e)
{
throw e;
}
catch (Throwable t)
{
logger.debug("Invocation of user-defined function '{}' failed", this, t);
if (t instanceof VirtualMachineError)
throw (VirtualMachineError) t;
throw FunctionExecutionException.create(this, t);
}
}
public static void assertUdfsEnabled(String language)
{
if (!DatabaseDescriptor.enableUserDefinedFunctions())
throw new InvalidRequestException("User-defined functions are disabled in cassandra.yaml - set user_defined_functions_enabled=true to enable");
if (!"java".equalsIgnoreCase(language))
throw new InvalidRequestException("Currently only Java UDFs are available in Cassandra. For more information - CASSANDRA-18252 and CASSANDRA-17281");
}
static void initializeThread()
{
// Get the TypeCodec stuff in Java Driver initialized.
// This is to get the classes loaded outside of the restricted sandbox's security context of a UDF.
TypeCodec.inet().format(InetAddress.getLoopbackAddress());
TypeCodec.ascii().format("");
}
private static final class ThreadIdAndCpuTime extends CompletableFuture<Object>
{
long threadId;
long cpuTime;
ThreadIdAndCpuTime()View on GitHub (pinned to 88fd0f6a0e)