{"record":{"id":"eb956f66b1687403","repo":"apache/cassandra","slug":"tablehistograms-requires-keyspace-table-or-ke","errorCode":null,"errorMessage":"tablehistograms requires <keyspace> <table> or <keyspace.table> format argument.","messagePattern":"tablehistograms requires <keyspace> <table> or <keyspace\\.table> format argument\\.","errorType":"validation","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java","lineNumber":89,"sourceCode":"        }\n\n        if (args.size() == 2 && args.stream().noneMatch(arg -> arg.contains(\".\")))\n        {\n            tablesList.put(args.get(0), args.get(1));\n        }\n        else if (args.size() == 1)\n        {\n            Pair<String, String> ksTbPair = parseTheKsTbPair(args.get(0));\n            tablesList.put(ksTbPair.left, ksTbPair.right);\n        }\n        else if (args.size() == 0)\n        {\n            // use all tables\n            tablesList = allTables;\n        }\n        else\n        {\n            throw new IllegalArgumentException(\"tablehistograms requires <keyspace> <table> or <keyspace.table> format argument.\");\n        }\n\n        // verify that all tables to list exist\n        for (String keyspace : tablesList.keys())\n        {\n            for (String table : tablesList.get(keyspace))\n            {\n                if (!allTables.containsEntry(keyspace, table))\n                    throw new IllegalArgumentException(\"Unknown table \" + keyspace + '.' + table);\n            }\n        }\n\n        for (String keyspace : tablesList.keys().elementSet())\n        {\n            for (String table : tablesList.get(keyspace))\n            {\n                // calculate percentile of row size and column count\n                long[] estimatedPartitionSize = (long[]) probe.getColumnFamilyMetric(keyspace, table, \"EstimatedPartitionSizeHistogram\");","sourceCodeStart":71,"sourceCodeEnd":107,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/tools/nodetool/TableHistograms.java#L71-L107","documentation":"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.","triggerScenarios":"Running e.g. `nodetool tablehistograms ks.` , `nodetool tablehistograms tbl1` (table without keyspace), or `nodetool tablehistograms a b c` (extra args).","commonSituations":"Quoting mistakes in scripts splitting 'ks.tbl' into separate args incorrectly, or passing a bare table name assuming a default keyspace.","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."],"exampleFix":"// before\nnodetool tablehistograms tbl1\n// after\nnodetool tablehistograms keyspace1.tbl1","handlingStrategy":"validation","validationCode":"function isAcceptable(args) { return args.length === 0 || args.length === 2 || (args.length === 1 && /^[^.]+\\.[^.]+$/.test(args[0])); }","typeGuard":"const isKsTable = (s) => typeof s === 'string' && /^[^\\s.]+\\.[^\\s.]+$/.test(s);","tryCatchPattern":"try { runTableHistograms(args); } catch (IllegalArgumentException e) { if (e.getMessage().includes('requires <keyspace> <table>')) printUsage(); else throw e; }","preventionTips":["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"],"tags":["nodetool","cli","arguments"],"backgroundTag":"invalid-argument-format","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}