apache/cassandra · error · IllegalArgumentException
--function option should be passed along with…
Error message
--function option should be passed along with --functions-in-keyspace option
What it means
When --function names a specific function, the command needs --functions-in-keyspace to locate it, because functions live inside a keyspace namespace. Missing it causes IllegalArgumentException in execute().
Solutions
- Add --functions-in-keyspace: nodetool invalidatepermissionscache --function <fn> --functions-in-keyspace <ks>
- If all functions in the keyspace are intended, omit --function and keep only --functions-in-keyspace
- Check option pairing with nodetool help invalidatepermissionscache
Example fix
// before nodetool invalidatepermissionscache --function my_fn // after nodetool invalidatepermissionscache --function my_fn --functions-in-keyspace my_ks
Defensive patterns
Strategy: validation
Validate before calling
if (args.includes('--function') && !args.includes('--functions-in-keyspace')) throw new Error('--function requires --functions-in-keyspace'); Try / catch
try { runNodetool('invalidatepermissionscache', ...args); } catch (IllegalArgumentException e) { /* handle missing --functions-in-keyspace */ } Prevention
- Treat --function and --functions-in-keyspace as a single unit in tooling
- Verify function existence in system_schema.functions before invalidating
- Use --all-functions when refreshing all UDF permissions
When it happens
Trigger: Running `nodetool invalidatepermissionscache --function <fn>` without `--functions-in-keyspace <ks>`.
Common situations: Operators refresh function permissions after UDF/UDA changes but forget the keyspace flag; scripts migrate from keyspace-level to function-level options.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- --all-tables option should be passed along with --keyspace…
- An error was encountered when looking up function…
- argument for top must be a positive integer.
- arguments for -F are json,yaml only.
- Can not parse replication factor
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/d2204820bbd4d3be.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/nodetool/InvalidatePermissionsCache.java:155
if (StringUtils.isNotEmpty(keyspace) && !allTables && StringUtils.isEmpty(table))
resourceNames.add(DataResource.keyspace(keyspace).getName());
// Roles Resources
if (allRoles)
resourceNames.add(RoleResource.root().getName());
if (StringUtils.isNotEmpty(role))
resourceNames.add(RoleResource.role(role).getName());
// Function Resources
if (allFunctions)
resourceNames.add(FunctionResource.root().getName());
if (StringUtils.isNotEmpty(function))
if (StringUtils.isNotEmpty(functionsInKeyspace))
resourceNames.add(constructFunctionResource(functionsInKeyspace, function));
else
throw new IllegalArgumentException("--function option should be passed along with --functions-in-keyspace option");
else
if (StringUtils.isNotEmpty(functionsInKeyspace))
resourceNames.add(FunctionResource.keyspace(functionsInKeyspace).getName());
// MBeans Resources
if (allMBeans)
resourceNames.add(JMXResource.root().getName());
if (StringUtils.isNotEmpty(mBean))
resourceNames.add(JMXResource.mbean(mBean).getName());
if (resourceNames.isEmpty())
throw new IllegalArgumentException("No resource options specified");
for (String resourceName : resourceNames)
probe.invalidatePermissionsCache(roleName, resourceName);
}
}View on GitHub (pinned to 88fd0f6a0e)