apache/cassandra · error · InvalidRequestException
Cannot filter this table by partial partition key
Error message
Cannot filter this table by partial partition key
What it means
The accord_debug journal table can only be filtered by a full (decorated) partition key. When the query's partition position is the minimum bound (partial/range filtering) the helper returns null, and if the position is a non-decorated key boundary (partial key), toJournalKey throws InvalidRequestException.
Source
Thrown at src/java/org/apache/cassandra/db/virtual/AccordDebugKeyspace.java:1546
if (filterTxnId.min != null || filterTxnId.max != null || minCommandStoreId >= 0 || maxCommandStoreId < Integer.MAX_VALUE)
{
min = new JournalKey(filterTxnId.min == null ? TxnId.NONE : filterTxnId.min, JournalKey.Type.COMMAND_DIFF, Math.max(0, minCommandStoreId));
max = new JournalKey(filterTxnId.max == null ? TxnId.MAX.withoutNonIdentityFlags() : filterTxnId.max, JournalKey.Type.COMMAND_DIFF, maxCommandStoreId);
}
}
accord.journal().forEach(key -> collect(collector, accord, key), min, max, true, 0);
}
abstract void collect(PartitionsCollector collector, AccordService accord, JournalKey key);
private static JournalKey toJournalKey(PartitionPosition position)
{
if (position.isMinimum())
return null;
if (!(position instanceof DecoratedKey))
throw new InvalidRequestException("Cannot filter this table by partial partition key");
ByteBuffer[] keys = PK.split(((DecoratedKey) position).getKey());
return new JournalKey(TxnId.parse(UTF8Type.instance.compose(keys[1])), JournalKey.Type.COMMAND_DIFF, Int32Type.instance.compose(keys[0]));
}
}
// TODO (desired): don't report null as "null"
public static abstract class AbstractTxnTable extends AbstractJournalTable
{
private AbstractTxnTable(String tableName)
{
super(parse(VIRTUAL_ACCORD_DEBUG, tableName,
"Accord per-CommandStore Transaction State",
"CREATE TABLE %s (\n" +
" command_store_id int,\n" +
" txn_id 'TxnIdUtf8Type',\n" +
" ballot_accepted text,\n" +
" ballot_promised text,\n" +View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Filter with exact equality on the full partition key (both composite key components: id and txn_id).
- Drop range/bounds predicates and iterate candidate keys client-side instead.
- Construct the key so position is a DecoratedKey, not a minimum/boundary token.
- Use the dedicated commands_for_key style tables for key-based lookups where applicable.
Example fix
// before
session.execute("SELECT * FROM system_views.accord_debug_journal WHERE key > 'some-prefix'");
// after
session.execute("SELECT * FROM system_views.accord_debug_journal WHERE key = 'full-partition-key-value'"); Defensive patterns
Strategy: validation
Validate before calling
if (!whereClause.matches("(?s).*key\s*=\s*'[^']+'\s*")) throw new IllegalArgumentException("journal table requires exact equality on the full partition key"); Try / catch
try { session.execute(query); } catch (com.datastax.driver.core.exceptions.InvalidQueryException e) { if (e.getMessage().contains("partial partition key")) { /* replace range predicate with exact key equality */ } else throw e; } Prevention
- Filter journal/debug tables only with full partition-key equality
- Avoid range or token predicates on accord_debug tables
- Iterate candidate keys client-side instead of server-side ranges
When it happens
Trigger: Querying the journal table with a token-range or partial partition-key filter (e.g. WHERE key > 'x' on part of a composite key, or TokenAware ranges) instead of an exact equality on the complete partition key.
Common situations: Browsing the journal table with range predicates from cqlsh; building tooling that slices the journal by txn id prefix; misunderstanding the composite key structure (id, txn_id).
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
- metadata + " currently only supports querying single partiti
- Cannot update '" + name + "'
- Can only unset '" + name + "'
- Modification is not supported by table " + metadata
- Unknown keyspace: '" + keyspaceName + "'
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/e4824b1accdb964f.
Report an issue: GitHub.