apache/cassandra · error · IllegalArgumentException

--table option should be passed along with --keyspace option

Error message

--table option should be passed along with --keyspace option

What it means

InvalidatePermissionsCache builds a table-scoped DataResource when --table is used, which is only valid together with --keyspace identifying the table's keyspace. If --table is set without --keyspace, execute() throws IllegalArgumentException.

Solutions

  1. Pass the keyspace: nodetool invalidatepermissionscache --table <table> --keyspace <ks>
  2. If the whole keyspace should be invalidated, drop --table and use only --keyspace
  3. Use fully qualified syntax check with nodetool help invalidatepermissionscache

Example fix

// before
nodetool invalidatepermissionscache --table users
// after
nodetool invalidatepermissionscache --table users --keyspace my_ks
Defensive patterns

Strategy: validation

Validate before calling

if (args.includes('--table') && !args.includes('--keyspace')) throw new Error('--table requires --keyspace');

Try / catch

try { runNodetool('invalidatepermissionscache', ...args); } catch (IllegalArgumentException e) { /* handle missing --keyspace */ }

Prevention

When it happens

Trigger: Running `nodetool invalidatepermissionscache --table <table>` without `--keyspace <ks>`.

Common situations: Operator assumes the table name alone is unambiguous; scripted commands from another tool pass only the table name; typos drop the keyspace flag.

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/e679a4990268d194. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/tools/nodetool/InvalidatePermissionsCache.java:135

        else
        {
            List<String> resourceNames = new ArrayList<>();

            // Data Resources
            if (allKeyspaces)
                resourceNames.add(DataResource.root().getName());

            if (allTables)
                if (StringUtils.isNotEmpty(keyspace))
                    resourceNames.add(DataResource.allTables(keyspace).getName());
                else
                    throw new IllegalArgumentException("--all-tables option should be passed along with --keyspace option");

            if (StringUtils.isNotEmpty(table))
                if (StringUtils.isNotEmpty(keyspace))
                    resourceNames.add(DataResource.table(keyspace, table).getName());
                else
                    throw new IllegalArgumentException("--table option should be passed along with --keyspace option");

            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));

View on GitHub (pinned to 88fd0f6a0e)