{"record":{"id":"653fc2d7cb7d99a1","repo":"apache/cassandra","slug":"metadata-currently-only-supports-querying-sing","errorCode":null,"errorMessage":"metadata + \" currently only supports querying single partitions\"","messagePattern":"metadata \\+ \" currently only supports querying single partitions\"","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java","lineNumber":452,"sourceCode":"            public int compareTo(Entry that)\n            {\n                return Integer.compare(this.commandStoreId, that.commandStoreId);\n            }\n        }\n\n        AbstractCommandsForKeyTable(TableMetadata metadata)\n        {\n            super(metadata, BEST_EFFORT, SORTED);\n        }\n\n        abstract void collect(PartitionCollector partition, int commandStoreId, CommandsForKey cfk);\n\n        @Override\n        public void collect(PartitionsCollector collector)\n        {\n            Object[] partitionKey = collector.singlePartitionKey();\n            if (partitionKey == null)\n                throw new InvalidRequestException(metadata + \" currently only supports querying single partitions\");\n\n            TokenKey key = TokenKey.parse((String) partitionKey[0], DatabaseDescriptor.getPartitioner());\n\n            List<Entry> cfks = new CopyOnWriteArrayList<>();\n            CommandStores commandStores = AccordService.unsafeInstance().node().commandStores();\n            AccordService.getBlocking(commandStores.forEach(\"commands_for_key table query\", RoutingKeys.of(key), Long.MIN_VALUE, Long.MAX_VALUE, safeStore -> {\n                SafeCommandsForKey safeCfk = safeStore.get(key);\n                CommandsForKey cfk = safeCfk.current();\n                if (cfk == null)\n                    return;\n\n                cfks.add(new Entry(safeStore.commandStore().id(), cfk));\n            }));\n\n            if (cfks.isEmpty())\n                return;\n\n            cfks.sort(collector.dataRange().isReversed() ? Comparator.reverseOrder() : Comparator.naturalOrder());","sourceCodeStart":434,"sourceCodeEnd":470,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java#L434-L470","documentation":"The accord_debug.commands_for_key virtual table can only answer queries restricted to exactly one partition key. PartitionsCollector.singlePartitionKey() returns null when the query is an unrestricted (or multi-partition) scan, and collect() then throws InvalidRequestException.","triggerScenarios":"Running 'SELECT * FROM system_views.accord_debug_commands_for_key' without a WHERE clause on the full partition key, or with an IN / range restriction that spans multiple partitions.","commonSituations":"Debugging Accord txn state by browsing the table like a normal table; cqlsh 'SELECT *' inspection of the debug keyspace; dashboards that attempt full scans of debug tables.","solutions":["Always include an equality predicate on the full partition key, e.g. WHERE key = '<token key>'.","Compute the token via nodetool or TokenKey.parse semantics before querying.","If a full listing is needed, iterate over candidate keys in the client instead of issuing an unrestricted scan.","Do not build generic table browsers against accord_debug tables; they require keyed access."],"exampleFix":"// before\nsession.execute(\"SELECT * FROM system_views.accord_debug_commands_for_key\");\n// after\nsession.execute(\"SELECT * FROM system_views.accord_debug_commands_for_key WHERE key = 'system_views.accord_debug_commands_for_key[key=<partition key>]'\");","handlingStrategy":"validation","validationCode":"if (!whereClause.toLowerCase().contains(\"key =\")) throw new IllegalArgumentException(\"accord_debug_commands_for_key requires an equality predicate on the full partition key\");","typeGuard":null,"tryCatchPattern":"try { session.execute(query); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains(\"only supports querying single partitions\")) { /* add partition key equality and retry */ } else throw e; }","preventionTips":["Always supply WHERE key = '<full key>' on accord_debug keyed tables","Do not use SELECT * without WHERE on debug keyspaces","Compute the TokenKey partition key before querying"],"tags":["virtual-table","partition-key","accord","invalid-request","cassandra"],"backgroundTag":"invalid-query-parameter","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}