apache/cassandra · error · InvalidRequestException
SASI indexes are disabled. Enable in cassandra.yaml to use.
Error message
SASI indexes are disabled. Enable in cassandra.yaml to use.
What it means
SASI (SSTable-Attached Secondary Index) indexes are gated behind a server configuration flag `sasi_indexes_enabled` in cassandra.yaml (default disabled since SASI is not fully supported). Creating a `CREATE CUSTOM INDEX ... USING 'org.apache.cassandra.index.sasi.SASIIndex'` is rejected with an InvalidRequestException when the flag is off.
Source
Thrown at src/java/org/apache/cassandra/cql3/statements/schema/CreateIndexStatement.java:152
// save the query state to use it for guardrails validation in #apply
this.state = state;
}
@Override
public boolean compatibleWith(ClusterMetadata metadata)
{
return metadata.directory.commonSerializationVersion.isAtLeast(Version.V0);
}
@Override
public Keyspaces apply(ClusterMetadata metadata)
{
attrs.validate();
Guardrails.createSecondaryIndexesEnabled.ensureEnabled("Creating secondary indexes", state);
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);
}
View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Set `sasi_indexes_enabled: true` in cassandra.yaml on all nodes and restart, if you intentionally want SASI.
- Prefer migrating the index to Storage-Attached Indexing (SAI) or a standard secondary index instead of enabling SASI.
- If the SASI DDL is incidental, remove/rewrite the `CREATE CUSTOM INDEX ... USING '...SASIIndex'` statement.
Example fix
// cassandra.yaml // before sasi_indexes_enabled: false // after sasi_indexes_enabled: true -- or before CREATE CUSTOM INDEX i ON t (col) USING 'org.apache.cassandra.index.sasi.SASIIndex'; -- after (SAI on 5.x) CREATE CUSTOM INDEX i ON t (col) USING 'StorageAttachedIndex';
Defensive patterns
Strategy: validation
Validate before calling
boolean sasiEnabled = conf.getBoolean("sasi_indexes_enabled", false);
if (ddl.contains("SASIIndex") && !sasiEnabled)
throw new IllegalStateException("SASI disabled in cassandra.yaml; enable sasi_indexes_enabled or rewrite DDL"); Try / catch
try { session.execute(createIndexDdl); }
catch (InvalidQueryException e) {
if (e.getMessage().contains("SASI indexes are disabled"))
throw new ConfigurationException("set sasi_indexes_enabled: true (or migrate to SAI)", e);
throw e;
} Prevention
- Check cassandra.yaml's sasi_indexes_enabled before shipping SASI DDL
- Prefer SAI or built-in 2i over SASI on modern versions since SASI is unsupported
- Keep DDL scripts environment-aware: gate SASI statements behind a feature flag
When it happens
Trigger: Executing `CREATE CUSTOM INDEX ... USING 'org.apache.cassandra.index.sasi.SASIIndex'` while `DatabaseDescriptor.getSASIIndexesEnabled()` returns false, i.e. `sasi_indexes_enabled: false` (or absent) in cassandra.yaml.
Common situations: Copying legacy SASI DDL onto a newer Cassandra install where SASI is disabled by default; migration scripts from 3.x that still create SASI indexes; cluster hardening where SASI was turned off for supportability.
Related errors
- Invalid data storage: ${value}. It shouldn't be more than ${
- Invalid data storage: value must be non-negative
- Invalid data storage: %d %s. It shouldn't be more than %d in
- Unsupported data storage unit: %s. Supported units are: %s
- Configured ${configName} "${intf}" could not be found
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/e2c01ce2280ee712.
Report an issue: GitHub.