{"record":{"id":"194ae88b46ef20e1","repo":"apache/cassandra","slug":"you-must-supply-a-table-name","errorCode":null,"errorMessage":"You must supply a table name","messagePattern":"You must supply a table name","errorType":"validation","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java","lineNumber":212,"sourceCode":"\n    private Set<ColumnFamilyStore> parseEntitiesForSnapshot(String... entities)\n    {\n        Set<ColumnFamilyStore> entitiesForSnapshot = new HashSet<>();\n\n        if (entities != null && entities.length > 0 && entities[0].contains(\".\"))\n        {\n            for (String entity : entities)\n            {\n                String[] splitted = StringUtils.split(entity, '.');\n                if (splitted.length == 2)\n                {\n                    String keyspaceName = splitted[0];\n                    String tableName = splitted[1];\n\n                    if (keyspaceName == null)\n                        throw new RuntimeException(\"You must supply a keyspace name\");\n                    if (tableName == null)\n                        throw new RuntimeException(\"You must supply a table name\");\n\n                    Keyspace validKeyspace = Keyspace.getValidKeyspace(keyspaceName);\n                    ColumnFamilyStore existingTable = validKeyspace.getColumnFamilyStore(tableName);\n\n                    entitiesForSnapshot.add(existingTable);\n                }\n                // special case for index which we can not normally create a snapshot for\n                // but a snapshot is apparently taken before a secondary index is scrubbed,\n                // so we preserve this behavior\n                else if (splitted.length == 3)\n                {\n                    String keyspaceName = splitted[0];\n                    String tableName = splitted[1];\n\n                    Keyspace validKeyspace = Keyspace.getValidKeyspace(keyspaceName);\n                    ColumnFamilyStore existingTable = validKeyspace.getColumnFamilyStore(tableName);\n                    Index indexByName = existingTable.indexManager.getIndexByName(splitted[2]);\n                    if (indexByName instanceof CassandraIndex)","sourceCodeStart":194,"sourceCodeEnd":230,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java#L194-L230","documentation":"parseEntitiesForSnapshot throws RuntimeException('You must supply a table name') when the table portion of a 'keyspace.table' entity string is null. Like the keyspace check, this validates the split tokens before resolving Keyspace and ColumnFamilyStore; an actual nonexistent table is rejected later by getColumnFamilyStore instead.","triggerScenarios":"Snapshot entity arguments of the form 'keyspace.' or with a null table token reaching the length==2 branch, e.g. via programmatic/JMX takeSnapshot calls with malformed entity strings.","commonSituations":"Scripts interpolating an empty/unset table variable into 'ks.$table'; hand-built JMX entity lists; copy-pasted commands dropping the table after the dot.","solutions":["Pass the full 'keyspace.table' name with a non-empty table part.","Check the table variable in the calling script for emptiness/null before invoking.","Use 'keyspace.*' or omit the entity entirely to snapshot all tables in a keyspace rather than a malformed name."],"exampleFix":"// before\nString entity = \"keyspace1.\"; // empty table part\n// after\nString entity = \"keyspace1.users\";","handlingStrategy":"validation","validationCode":"int dot = entity.indexOf('.');\nString table = entity.substring(dot + 1);\nif (table.isEmpty()) throw new IllegalArgumentException(\"Empty table in entity \" + entity);","typeGuard":null,"tryCatchPattern":"try { takeSnapshot(entities); } catch (RuntimeException e) { if (e.getMessage().equals(\"You must supply a table name\")) throw new IllegalArgumentException(\"Missing table in entity \" + entities, e); throw e; }","preventionTips":["Interpolate table names with a guard against empty strings","Validate each entity against ^[^.]+\\.[^.]+$ before invocation","Use keyspace-level snapshots when targeting all tables"],"tags":["snapshot","table","argument-validation"],"backgroundTag":"missing-required-argument","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}