apache/cassandra · error · InvalidRequestException
The receiver table %s.%s specified by call to function %s ha
Error message
The receiver table %s.%s specified by call to function %s hasn't been found
What it means
InvalidRequestException from the token() function factory (getOrCreateFunction): the table context the token() call refers to (receiver table in the receiver keyspace) does not exist in schema. token() must be resolved against a real table's partition-key types, so a missing receiver table cannot be prepared. The companion guard rejects a null receiverKeyspace.
Source
Thrown at src/java/org/apache/cassandra/cql3/functions/TokenFct.java:91
public static void addFunctionsTo(NativeFunctions functions)
{
functions.add(new FunctionFactory("token")
{
@Override
public NativeFunction getOrCreateFunction(List<? extends AssignmentTestable> args,
AbstractType<?> receiverType,
String receiverKeyspace,
String receiverTable)
{
if (receiverKeyspace == null)
throw new InvalidRequestException("No receiver keyspace has been specified for function " + name);
if (receiverTable == null)
throw new InvalidRequestException("No receiver table has been specified for function " + name);
TableMetadata metadata = Schema.instance.getTableMetadata(receiverKeyspace, receiverTable);
if (metadata == null)
throw new InvalidRequestException(String.format("The receiver table %s.%s specified by call to " +
"function %s hasn't been found",
receiverKeyspace, receiverTable, name));
return new TokenFct(metadata);
}
@Override
protected NativeFunction doGetOrCreateFunction(List<AbstractType<?>> argTypes, AbstractType<?> receiverType)
{
throw new AssertionError("Should be unreachable");
}
});
}
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Verify the table exists: DESC keyspace; or query system_schema.tables
- Correct the keyspace/table spelling (identifiers are case-sensitive unless quoted)
- If the table was dropped/recreated, re-prepare statements and retry the query
- Wait for schema agreement across the cluster before retrying after DDL
Example fix
// before SELECT * FROM my_ks.mytable WHERE token(pk) > 0; // NoSuchTable // after SELECT * FROM my_ks."MyTable" WHERE token(pk) > 0; // correct quoting/case
Defensive patterns
Strategy: validation
Validate before calling
ResultSet rs = session.execute(
"SELECT keyspace_name FROM system_schema.tables WHERE keyspace_name=? AND table_name=?", ks, table);
if (rs.wasApplied() && rs.all().isEmpty()) throw new IllegalStateException("Table " + ks + "." + table + " does not exist"); Try / catch
try { session.execute(query); }
catch (InvalidRequestException e) {
if (e.getMessage().contains("hasn't been found")) { /* refresh schema, verify table, retry */ }
else throw e;
} Prevention
- Verify table existence (or use a schema cache) before queries referencing it
- After DROP/CREATE TABLE, re-prepare statements and wait for schema agreement
- Watch identifier case-sensitivity; quote names when necessary
When it happens
Trigger: SELECT/condition invoking token() against keyspace.table that does not exist on this node — dropped table, typo in name, keyspace not replicated to this datacenter, or query racing a DROP TABLE.
Common situations: Stale prepared statements after a table was dropped and recreated with different options; typos or case-sensitivity mistakes in keyspace/table names; multi-DC setups where schema has not propagated yet.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- No receiver keyspace has been specified for function
- No receiver table has been specified for function ${name}
- category %s not found in %s
- 'Get CIDR groups for IP' operation not supported by %s
- ACCESS TO DATACENTERS operations not supported by AllowAllNe
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/643467003bda7b6a.
Report an issue: GitHub.