{"record":{"id":"6c77c24439999641","repo":"apache/cassandra","slug":"unknown-index","errorCode":null,"errorMessage":"Unknown index ","messagePattern":"Unknown index ","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java","lineNumber":237,"sourceCode":"                // 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)\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                }","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/snapshot/TakeSnapshotTask.java#L219-L255","documentation":"When a snapshot entity names a secondary index (keyspace.index_name), parseEntitiesForSnapshot looks up the index among the table's IndexManager indexes; if the name doesn't match any known index it throws IllegalArgumentException('Unknown index <entity>'). Snapshots can target built-in (CassandraIndex) index backing tables, but only indexes that actually exist on that table.","triggerScenarios":"nodetool snapshot --table ks.index_name where the index doesn't exist on the table, was dropped, or is a custom/SAI index whose handler isn't a CassandraIndex; typos in index names (often with the table's generated 6-char suffix confusion).","commonSituations":"Snapshotting index backing tables by their internal name (e.g. users_by_email_idx) after the index was recreated with a different name; assuming all index types are snapshot-targetable; case-sensitivity mistakes on quoted identifiers.","solutions":["Verify the index exists: DESCRIBE the table or check system_schema.indexes for the exact name.","If the goal is the underlying data, snapshot the base table instead — index backing SSTables are included automatically.","Recreate the index if it was dropped; custom (non-CassandraIndex) indexes cannot be targeted directly this way."],"exampleFix":"// before\nnodetool snapshot -ks ks -cf users_by_old_idx   # index dropped\n// after\nnodetool snapshot -ks ks -cf users   # base table includes indexes\n","handlingStrategy":"validation","validationCode":"TableMetadata tm = Schema.instance.validateTable(ks, table);\nif (tm == null || !tm.indexes.hasIndex(indexName))\n    throw new IllegalArgumentException(\"Index not found: \" + indexName);","typeGuard":null,"tryCatchPattern":"try { snapshot(entity); } catch (IllegalArgumentException e) { if (e.getMessage().startsWith(\"Unknown index\")) { snapshotBaseTable(ks, table); } else throw e; }","preventionTips":["Look up exact index names in system_schema.indexes before snapshotting","Snapshot the base table instead of index backing tables","Re-check index existence after index drops/recreations"],"tags":["snapshot","secondary-index","entity-not-found"],"backgroundTag":"resource-not-found","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"}