apache/cassandra · error · InvalidRequestException

metadata + " currently only supports querying single partiti

Error message

metadata + " currently only supports querying single partitions"

What it means

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.

Source

Thrown at src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:452

            public int compareTo(Entry that)
            {
                return Integer.compare(this.commandStoreId, that.commandStoreId);
            }
        }

        AbstractCommandsForKeyTable(TableMetadata metadata)
        {
            super(metadata, BEST_EFFORT, SORTED);
        }

        abstract void collect(PartitionCollector partition, int commandStoreId, CommandsForKey cfk);

        @Override
        public void collect(PartitionsCollector collector)
        {
            Object[] partitionKey = collector.singlePartitionKey();
            if (partitionKey == null)
                throw new InvalidRequestException(metadata + " currently only supports querying single partitions");

            TokenKey key = TokenKey.parse((String) partitionKey[0], DatabaseDescriptor.getPartitioner());

            List<Entry> cfks = new CopyOnWriteArrayList<>();
            CommandStores commandStores = AccordService.unsafeInstance().node().commandStores();
            AccordService.getBlocking(commandStores.forEach("commands_for_key table query", RoutingKeys.of(key), Long.MIN_VALUE, Long.MAX_VALUE, safeStore -> {
                SafeCommandsForKey safeCfk = safeStore.get(key);
                CommandsForKey cfk = safeCfk.current();
                if (cfk == null)
                    return;

                cfks.add(new Entry(safeStore.commandStore().id(), cfk));
            }));

            if (cfks.isEmpty())
                return;

            cfks.sort(collector.dataRange().isReversed() ? Comparator.reverseOrder() : Comparator.naturalOrder());

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Always include an equality predicate on the full partition key, e.g. WHERE key = '<token key>'.
  2. Compute the token via nodetool or TokenKey.parse semantics before querying.
  3. If a full listing is needed, iterate over candidate keys in the client instead of issuing an unrestricted scan.
  4. Do not build generic table browsers against accord_debug tables; they require keyed access.

Example fix

// before
session.execute("SELECT * FROM system_views.accord_debug_commands_for_key");
// after
session.execute("SELECT * FROM system_views.accord_debug_commands_for_key WHERE key = 'system_views.accord_debug_commands_for_key[key=<partition key>]'");
Defensive patterns

Strategy: validation

Validate before calling

if (!whereClause.toLowerCase().contains("key =")) throw new IllegalArgumentException("accord_debug_commands_for_key requires an equality predicate on the full partition key");

Try / catch

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

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Invalid query parameter" / "Failed to parse value of ...": fixing bad query string parameters across APIs — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/653fc2d7cb7d99a1. Report an issue: GitHub.