apache/cassandra · error · RuntimeException
You must supply a keyspace name
Error message
You must supply a keyspace name
What it means
parseEntitiesForSnapshot parses 'keyspace.table' entity strings and throws RuntimeException('You must supply a keyspace name') when the keyspace part is null. In practice the split already guaranteed two tokens, so this guards a null/empty keyspace name supplied to the snapshot entity parser before Keyspace.getValidKeyspace is called. Note that a present-but-missing keyspace is instead rejected later by getValidKeyspace.
Solutions
- Supply entities in 'keyspace.table' form with a non-empty keyspace name.
- Verify the calling script's keyspace variable is set and non-empty before invoking the snapshot.
- Prefer nodetool snapshot CLI parsing, which validates entity format before reaching this code.
Example fix
// before String entity = ".users"; // empty keyspace part // after String entity = "keyspace1.users";
Defensive patterns
Strategy: validation
Validate before calling
if (entity == null || entity.indexOf('.') <= 0)
throw new IllegalArgumentException("Entity must be keyspace.table: " + entity);
String ks = entity.substring(0, entity.indexOf('.'));
if (ks.isEmpty()) throw new IllegalArgumentException("Empty keyspace in entity " + entity); Try / catch
try { takeSnapshot(entities); } catch (RuntimeException e) { if (e.getMessage().equals("You must supply a keyspace name")) throw new IllegalArgumentException("Malformed entity: " + entities, e); throw e; } Prevention
- Always build entities as 'keyspace.table' from two non-null variables
- Validate entity format before JMX calls
- Prefer nodetool CLI parsing over hand-built strings
When it happens
Trigger: Calling the snapshot API/StorageService.takeSnapshot with entity strings lacking a keyspace portion (null keyspace token reaching this branch), e.g. passing malformed entity arguments programmatically via JMX.
Common situations: JMX/console invocations constructing entity strings manually instead of via nodetool parsing; scripts building 'keyspace.table' pairs where the keyspace variable is unset/null.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Cannot take a snapshot on secondary index or invalid column…
- You must supply a table name
- A range supplied to SSTableCursorReader ends before it…
- Argument must have keyspace and table values.
- arguments for -F are json, yaml, table only.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/77345f0b922f6b7e.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java:210
snapshotToCreate.complete();
}
private Set<ColumnFamilyStore> parseEntitiesForSnapshot(String... entities)
{
Set<ColumnFamilyStore> entitiesForSnapshot = new HashSet<>();
if (entities != null && entities.length > 0 && entities[0].contains("."))
{
for (String entity : entities)
{
String[] splitted = StringUtils.split(entity, '.');
if (splitted.length == 2)
{
String keyspaceName = splitted[0];
String tableName = splitted[1];
if (keyspaceName == null)
throw new RuntimeException("You must supply a keyspace name");
if (tableName == null)
throw new RuntimeException("You must supply a table name");
Keyspace validKeyspace = Keyspace.getValidKeyspace(keyspaceName);
ColumnFamilyStore existingTable = validKeyspace.getColumnFamilyStore(tableName);
entitiesForSnapshot.add(existingTable);
}
// special case for index which we can not normally create a snapshot for
// but a snapshot is apparently taken before a secondary index is scrubbed,
// so we preserve this behavior
else if (splitted.length == 3)
{
String keyspaceName = splitted[0];
String tableName = splitted[1];
Keyspace validKeyspace = Keyspace.getValidKeyspace(keyspaceName);
ColumnFamilyStore existingTable = validKeyspace.getColumnFamilyStore(tableName);View on GitHub (pinned to 88fd0f6a0e)