apache/cassandra · error · java.lang.IllegalArgumentException
tablehistograms requires
Error message
tablehistograms requires <keyspace> <table> or <keyspace.table> format argument.
What it means
nodetool tablehistograms (tablehistograms command) expects table targets as '<keyspace> <table>' or '<keyspace.table>'; any other argument shape is rejected with IllegalArgumentException. Only zero arguments (all tables) or these accepted forms proceed.
Solutions
- Pass a single '<keyspace.table>' argument, e.g. `nodetool tablehistograms ks1.tbl1`.
- Or pass two positional arguments '<keyspace> <table>', e.g. `nodetool tablehistograms ks1 tbl1`.
- Call with no arguments to get histograms for all tables.
Example fix
// before nodetool tablehistograms tbl1 // after nodetool tablehistograms keyspace1.tbl1
Defensive patterns
Strategy: validation
Validate before calling
function isAcceptable(args) { return args.length === 0 || args.length === 2 || (args.length === 1 && /^[^.]+\.[^.]+$/.test(args[0])); } Type guard
const isKsTable = (s) => typeof s === 'string' && /^[^\s.]+\.[^\s.]+$/.test(s);
Try / catch
try { runTableHistograms(args); } catch (IllegalArgumentException e) { if (e.getMessage().includes('requires <keyspace> <table>')) printUsage(); else throw e; } Prevention
- Quote 'keyspace.table' as a single argument in shell scripts
- Normalize inputs to either 'ks tbl' or 'ks.tbl' before invoking
- Use the no-arg form when all tables are wanted
When it happens
Trigger: Running e.g. `nodetool tablehistograms ks.` , `nodetool tablehistograms tbl1` (table without keyspace), or `nodetool tablehistograms a b c` (extra args).
Common situations: Quoting mistakes in scripts splitting 'ks.tbl' into separate args incorrectly, or passing a bare table name assuming a default keyspace.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- argument for sort must be one of
- argument for top must be a positive integer.
- arguments for -F are json,yaml only.
- arguments for -F are json,yaml only.
- arguments for -F are json,yaml only.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/eb956f66b1687403.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java:89
}
if (args.size() == 2 && args.stream().noneMatch(arg -> arg.contains(".")))
{
tablesList.put(args.get(0), args.get(1));
}
else if (args.size() == 1)
{
Pair<String, String> ksTbPair = parseTheKsTbPair(args.get(0));
tablesList.put(ksTbPair.left, ksTbPair.right);
}
else if (args.size() == 0)
{
// use all tables
tablesList = allTables;
}
else
{
throw new IllegalArgumentException("tablehistograms requires <keyspace> <table> or <keyspace.table> format argument.");
}
// verify that all tables to list exist
for (String keyspace : tablesList.keys())
{
for (String table : tablesList.get(keyspace))
{
if (!allTables.containsEntry(keyspace, table))
throw new IllegalArgumentException("Unknown table " + keyspace + '.' + table);
}
}
for (String keyspace : tablesList.keys().elementSet())
{
for (String table : tablesList.get(keyspace))
{
// calculate percentile of row size and column count
long[] estimatedPartitionSize = (long[]) probe.getColumnFamilyMetric(keyspace, table, "EstimatedPartitionSizeHistogram");View on GitHub (pinned to 88fd0f6a0e)