apache/cassandra · error · InvalidRequestException
Index ' ' already exists
Error message
Index '%s' already exists
What it means
CreateIndexStatement.apply: an index with the given/generated name already exists in the keyspace and IF NOT EXISTS was not specified, so creation is rejected to avoid silently overwriting index definitions.
Solutions
- Use IF NOT EXISTS if the existing index is acceptable.
- Drop the existing index (DROP INDEX) or choose a different index name.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java:168 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/ee225ccb54f7508d.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java:168
if (attrs.isCustom && attrs.customClass.equals(SASIIndex.class.getName()) && !DatabaseDescriptor.getSASIIndexesEnabled())
throw new InvalidRequestException(SASI_INDEX_DISABLED);
Keyspaces schema = metadata.schema.getKeyspaces();
KeyspaceMetadata keyspace = schema.getNullable(keyspaceName);
if (null == keyspace)
throw ire(KEYSPACE_DOES_NOT_EXIST, keyspaceName);
TableMetadata table = keyspace.getTableOrViewNullable(tableName);
if (null == table)
throw ire(TABLE_DOES_NOT_EXIST, tableName);
if (null != indexName && keyspace.hasIndex(indexName))
{
if (ifNotExists)
return schema;
throw ire(INDEX_ALREADY_EXISTS, indexName);
}
if (table.isCounter())
throw ire(COUNTER_TABLES_NOT_SUPPORTED);
if (table.isView())
throw ire(MATERIALIZED_VIEWS_NOT_SUPPORTED);
if (keyspace.replicationStrategy.hasTransientReplicas())
throw new InvalidRequestException(TRANSIENTLY_REPLICATED_KEYSPACE_NOT_SUPPORTED);
// guardrails to limit number of secondary indexes per table.
Guardrails.secondaryIndexesPerTable.guard(table.indexes.size() + 1,
Strings.isNullOrEmpty(indexName)
? String.format("on table %s", table.name)
: String.format("%s on table %s", indexName, table.name),
false,
state);View on GitHub (pinned to 88fd0f6a0e)