apache/cassandra · error · IllegalArgumentException

Invalid index specified: %s/%s.

Error message

Invalid index specified: %s/%s.

What it means

In Keyspace.getValidColumnFamilies, when a CF name is given in the form baseTable/indexName, the code looks up the index by name on the base table's SecondaryIndexManager. If no such index exists it throws IllegalArgumentException("Invalid index specified: base/index."). It guards index-scoped operations (e.g. compaction, cleanup) against nonexistent indexes.

Source

Thrown at src/java/org/apache/cassandra/db/Keyspace.java:648

        }

        // include the specified stores and possibly the stores of any of their indexes
        for (String cfName : cfNames)
        {
            if (SecondaryIndexManager.isIndexColumnFamily(cfName))
            {
                if (!allowIndexes)
                {
                    logger.warn("Operation not allowed on secondary Index table ({})", cfName);
                    continue;
                }
                String baseName = SecondaryIndexManager.getParentCfsName(cfName);
                String indexName = SecondaryIndexManager.getIndexName(cfName);

                ColumnFamilyStore baseCfs = getColumnFamilyStore(baseName);
                Index index = baseCfs.indexManager.getIndexByName(indexName);
                if (index == null)
                    throw new IllegalArgumentException(String.format("Invalid index specified: %s/%s.",
                                                                     baseCfs.metadata.name,
                                                                     indexName));

                if (index.getBackingTable().isPresent())
                    valid.add(index.getBackingTable().get());
            }
            else
            {
                ColumnFamilyStore cfStore = getColumnFamilyStore(cfName);
                valid.add(cfStore);
                if (autoAddIndexes)
                    valid.addAll(getIndexColumnFamilyStores(cfStore));
            }
        }

        return valid;
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. List existing indexes with `DESCRIBE TABLE` or query system_schema.indexes and use the exact index name.
  2. Recreate the missing index (CREATE INDEX / CREATE CUSTOM INDEX) if it should exist.
  3. If you meant the base table, pass the table name without the '/index' suffix.

Example fix

// before
keyspace.getValidColumnFamilies(null, "users_by_email_idx"); // treated as table/index, wrong
// after
keyspace.getValidColumnFamilies(null, "users/users_by_email_idx"); // base table / index name that exists
Defensive patterns

Strategy: validation

Validate before calling

ColumnFamilyStore cfs = Keyspace.open(ks).getColumnFamilyStore(baseTable);
if (cfs.indexManager.getIndexByName(indexName) == null)
    throw new IllegalArgumentException("index missing: " + baseTable + "/" + indexName);

Try / catch

try { return ks.getValidColumnFamilies(null, tableName); } catch (IllegalArgumentException e) { LOG.warn("bad table/index spec", e); return Collections.emptySet(); }

Prevention

When it happens

Trigger: Calling Keyspace.getValidColumnFamilies(keyspace, ..., "table/index_name") where index_name was never created or was already dropped; passing a table name containing '/' that is not actually an index reference.

Common situations: Operational commands like `nodetool compact ks tableidx` after an index was dropped; misremembered index names (SASI/SAI/2i naming differs); scripts built for one cluster reused on another where indexes differ.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/eb7b8773ad2d6442. Report an issue: GitHub.