apache/cassandra · warning · IllegalArgumentException
Unknown keyspace
Error message
Unknown keyspace %s
What it means
ColumnIndexesSystemView.data() iterates user keyspaces from Schema metadata and then fetches the live Keyspace instance. If a keyspace exists in metadata but has no live instance (dropped concurrently), getKeyspaceInstance returns null and data() throws IllegalArgumentException("Unknown keyspace ..."). This is a race between schema iteration and keyspace teardown.
Solutions
- Retry the virtual-table query after the DROP completes
- Avoid querying system_views.column_indexes concurrently with keyspace drops
- Upgrade — newer versions skip such keyspaces instead of throwing
Example fix
null
Defensive patterns
Strategy: retry
Try / catch
for (int i = 0; i < 3; i++) {
try { rs = session.execute(queryVirtualTable); break; }
catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown keyspace")) { sleep(backoff); continue; }
throw e;
}
} Prevention
- Avoid polling virtual tables during DROP KEYSPACE
- Serialize schema changes against monitoring reads in tests
- Treat transient 'Unknown keyspace' on views as retryable
When it happens
Trigger: Querying the column_indexes virtual table while a keyspace is being dropped concurrently — Schema.instance.getUserKeyspaces() lists the keyspace, but its instance is gone by the time getKeyspaceInstance runs.
Common situations: Monitoring dashboards polling virtual tables during DROP KEYSPACE; test suites dropping schemas while another client reads virtual tables.
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
- Unknown keyspace . This can occur if the keyspace is being…
- Unknown keyspace . This can occur if the keyspace is being…
- Cannot create more than one storage-attached index on the…
- Cannot instantiate a non-virtual table
- Keyspace does not exist
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/2b87d9dd3ad84dd7.
Report an issue: GitHub.
Appendix: source
Thrown at src/java/org/apache/cassandra/index/sai/virtual/ColumnIndexesSystemView.java:85
.build());
}
@Override
public void apply(PartitionUpdate update)
{
throw new InvalidRequestException("Modification is not supported by table " + metadata);
}
@Override
public DataSet data()
{
SimpleDataSet dataset = new SimpleDataSet(metadata());
for (KeyspaceMetadata ks: Schema.instance.getUserKeyspaces())
{
Keyspace keyspace = Schema.instance.getKeyspaceInstance(ks.name);
if (keyspace == null)
throw new IllegalArgumentException("Unknown keyspace " + ks.name);
for (ColumnFamilyStore cfs : keyspace.getColumnFamilyStores())
{
SecondaryIndexManager manager = cfs.indexManager;
StorageAttachedIndexGroup group = StorageAttachedIndexGroup.getIndexGroup(cfs);
if (group != null)
{
group.getIndexes().forEach(i -> {
StorageAttachedIndex index = (StorageAttachedIndex) i;
String indexName = index.identifier().indexName;
dataset.row(ks.name, indexName)
.column(TABLE_NAME, cfs.name)
.column(COLUMN_NAME, index.termType().columnName())
.column(IS_QUERYABLE, manager.isIndexQueryable(index))
.column(IS_BUILDING, manager.isIndexBuilding(indexName))
.column(IS_STRING, index.termType().isLiteral())View on GitHub (pinned to 88fd0f6a0e)