{"record":{"id":"3bb4f95af148a10d","repo":"apache/cassandra","slug":"cannot-take-a-snapshot-on-secondary-index-or-inval","errorCode":null,"errorMessage":"Cannot take a snapshot on secondary index or invalid column family name. You must supply a column family name in the form of keyspace.columnfamily","messagePattern":"Cannot take a snapshot on secondary index or invalid column family name\\. You must supply a column family name in the form of keyspace\\.columnfamily","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java","lineNumber":242,"sourceCode":"                    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)\n                    {\n                        ColumnFamilyStore indexCfs = ((CassandraIndex) indexByName).getIndexCfs();\n                        entitiesForSnapshot.add(indexCfs);\n                    }\n                    else\n                    {\n                        throw new IllegalArgumentException(\"Unknown index \" + entity);\n                    }\n                }\n                else\n                {\n                    throw new IllegalArgumentException(\"Cannot take a snapshot on secondary index or invalid column \" +\n                                                       \"family name. You must supply a column family name in the \" +\n                                                       \"form of keyspace.columnfamily\");\n                }\n            }\n        }\n        else\n        {\n            if (entities != null && entities.length == 0)\n            {\n                for (Keyspace keyspace : Keyspace.all())\n                {\n                    entitiesForSnapshot.addAll(keyspace.getColumnFamilyStores());\n                }\n            }\n            else if (entities != null)\n            {\n                for (String keyspace : entities)\n                {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java#L224-L260","documentation":"parseEntitiesForSnapshot throws IllegalArgumentException when an entity string is neither 'keyspace.table' with a valid length-2 split nor a recognized index name: the caller must supply a column family in the form keyspace.columnfamily. Secondary indexes can only be referenced indirectly as valid index names; anything else (bare table name without keyspace, extra dots, plain garbage) lands here.","triggerScenarios":"nodetool snapshot --table mytable (no keyspace prefix); entity strings with more than one dot; passing an index-like name when the split produces unexpected token counts via JMX/programmatic takeSnapshot calls.","commonSituations":"Scripts omitting the keyspace because they assumed a default keyspace is in scope; users trying to snapshot a secondary index directly; JMX invocations with wrong entity format (comma vs space separation).","solutions":["Always qualify the table: nodetool snapshot -ks <keyspace> -cf <table> or pass 'keyspace.table' entities.","Check for stray characters (extra dots, spaces) in entity strings.","To snapshot a whole keyspace, use -ks alone rather than malformed per-table entities."],"exampleFix":"// before\nnodetool snapshot --table users\n// after\nnodetool snapshot --keyspace keyspace1 --table users","handlingStrategy":"validation","validationCode":"if (!entity.matches(\"[^.]+\\.[^.]+\") && !isKnownIndex(entity))\n    throw new IllegalArgumentException(\"Entity must be keyspace.columnfamily: \" + entity);","typeGuard":null,"tryCatchPattern":"try { takeSnapshot(entities); } catch (IllegalArgumentException e) { if (e.getMessage().contains(\"form of keyspace.columnfamily\")) throw new IllegalArgumentException(\"Bad snapshot entity format: \" + entities, e); throw e; }","preventionTips":["Always qualify tables with their keyspace","Reject entity strings containing more than one dot","Document keyspace.columnfamily format in operational scripts"],"tags":["snapshot","entity-format","argument-validation"],"backgroundTag":"invalid-argument-format","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"}