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

  1. Add --functions-in-keyspace: nodetool invalidatepermissionscache --function <fn> --functions-in-keyspace <ks>
  2. If all functions in the keyspace are intended, omit --function and keep only --functions-in-keyspace
  3. 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

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


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)