apache/cassandra · error · IllegalArgumentException
The keyspace {keyspace}, does not exist
Error message
The keyspace {keyspace}, does not exist What it means
The ownership-reporting path (effectiveOwnership / describeOwnership) looks up the requested keyspace in the cluster schema (ClusterMetadata). If the keyspace does not exist anywhere in the schema, it throws IllegalArgumentException rather than returning empty ownership. It is a caller-input validation error.
Source
Thrown at src/java/org/apache/cassandra/service/StorageService.java:4261
* total ownership will be a multiple of the number of DC's and this value will then go up within each DC depending
* on the number of replicas within itself. For DC unaware replication strategies, ownership without replication
* will be 100%.
*
* @throws IllegalStateException when node is not configured properly.
*/
private LinkedHashMap<InetAddressAndPort, Float> getEffectiveOwnership(String keyspace)
{
ClusterMetadata metadata = ClusterMetadata.current();
ReplicationParams replicationParams = null;
AbstractReplicationStrategy strategy;
if (keyspace != null)
{
if (isLocalSystemKeyspace(keyspace))
throw new IllegalStateException("Ownership values for keyspaces with LocalStrategy are meaningless");
KeyspaceMetadata keyspaceInstance = metadata.schema.getKeyspaces().getNullable(keyspace);
if (keyspaceInstance == null)
throw new IllegalArgumentException("The keyspace " + keyspace + ", does not exist");
if (keyspaceInstance.replicationStrategy instanceof LocalStrategy)
throw new IllegalStateException("Ownership values for keyspaces with LocalStrategy are meaningless");
strategy = keyspaceInstance.replicationStrategy;
replicationParams = keyspaceInstance.params.replication;
}
else
{
Set<String> userKeyspaces = metadata.schema.getKeyspaces()
.without(SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES)
.names();
if (userKeyspaces.size() > 0)
{
keyspace = userKeyspaces.iterator().next();
AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy();
for (String keyspaceName : userKeyspaces)View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Verify the exact keyspace name with `cqlsh: DESCRIBE KEYSPACES;` and retry
- Create the keyspace if it was never intended to be dropped
- Fix automation that passes a stale keyspace variable
- Check `nodetool describecluster`/schema agreement if the keyspace exists locally but not cluster-wide
Example fix
// before nodetool describeownership mykeyspce # typo -> does not exist // after cqlsh -e 'DESCRIBE KEYSPACES;' # confirm name nodetool describeownership mykeyspace
Defensive patterns
Strategy: validation
Validate before calling
boolean exists = StorageProxy.iterateRangesFromTable(...) /* or simply */;
// via Schema/ClusterMetadata on server-side tooling:
if (ClusterMetadata.current().schema.getKeyspaces().getNullable(keyspace) == null)
fail("keyspace " + keyspace + " does not exist");
// via client: cqlsh -e 'DESCRIBE KEYSPACES' and grep Try / catch
try { ss.effectiveOwnership(ks); } catch (IllegalArgumentException e) { if (e.getMessage().endsWith("does not exist")) { log.warn("typo or dropped keyspace: {}", ks); } throw e; } Prevention
- Enumerate keyspaces from the cluster (DESCRIBE KEYSPACES) instead of hardcoding names
- Pass keyspace names as verified arguments in scripts
- Watch for drops that happen between listing and querying
When it happens
Trigger: Calling `nodetool describeownership <ks>` (or effectiveOwnership/describeLocalOwnership) with a misspelled or dropped keyspace name.
Common situations: Typo in nodetool argument; keyspace dropped by another operator between listing and querying; environment mismatch (querying a keyspace that exists in another cluster).
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
- Keyspace %s doesn't exist
- Unknown type
- keyspace %s does not exist
- No such keyspace:
- There is no ring for the keyspace:
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/081df03d8a530a87.
Report an issue: GitHub.