{"record":{"id":"081df03d8a530a87","repo":"apache/cassandra","slug":"the-keyspace-keyspace-does-not-exist","errorCode":null,"errorMessage":"The keyspace {keyspace}, does not exist","messagePattern":"The keyspace (.+?), does not exist","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/service/StorageService.java","lineNumber":4261,"sourceCode":"     * total ownership will be a multiple of the number of DC's and this value will then go up within each DC depending\n     * on the number of replicas within itself. For DC unaware replication strategies, ownership without replication\n     * will be 100%.\n     *\n     * @throws IllegalStateException when node is not configured properly.\n     */\n    private LinkedHashMap<InetAddressAndPort, Float> getEffectiveOwnership(String keyspace)\n    {\n        ClusterMetadata metadata = ClusterMetadata.current();\n        ReplicationParams replicationParams = null;\n        AbstractReplicationStrategy strategy;\n        if (keyspace != null)\n        {\n            if (isLocalSystemKeyspace(keyspace))\n                throw new IllegalStateException(\"Ownership values for keyspaces with LocalStrategy are meaningless\");\n\n            KeyspaceMetadata keyspaceInstance = metadata.schema.getKeyspaces().getNullable(keyspace);\n            if (keyspaceInstance == null)\n                throw new IllegalArgumentException(\"The keyspace \" + keyspace + \", does not exist\");\n\n            if (keyspaceInstance.replicationStrategy instanceof LocalStrategy)\n                throw new IllegalStateException(\"Ownership values for keyspaces with LocalStrategy are meaningless\");\n\n            strategy = keyspaceInstance.replicationStrategy;\n            replicationParams = keyspaceInstance.params.replication;\n        }\n        else\n        {\n            Set<String> userKeyspaces = metadata.schema.getKeyspaces()\n                                                       .without(SchemaConstants.REPLICATED_SYSTEM_KEYSPACE_NAMES)\n                                                       .names();\n\n            if (userKeyspaces.size() > 0)\n            {\n                keyspace = userKeyspaces.iterator().next();\n                AbstractReplicationStrategy replicationStrategy = Schema.instance.getKeyspaceInstance(keyspace).getReplicationStrategy();\n                for (String keyspaceName : userKeyspaces)","sourceCodeStart":4243,"sourceCodeEnd":4279,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/service/StorageService.java#L4243-L4279","documentation":"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.","triggerScenarios":"Calling `nodetool describeownership <ks>` (or effectiveOwnership/describeLocalOwnership) with a misspelled or dropped keyspace name.","commonSituations":"Typo in nodetool argument; keyspace dropped by another operator between listing and querying; environment mismatch (querying a keyspace that exists in another cluster).","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"],"exampleFix":"// before\nnodetool describeownership mykeyspce  # typo -> does not exist\n// after\ncqlsh -e 'DESCRIBE KEYSPACES;'  # confirm name\nnodetool describeownership mykeyspace","handlingStrategy":"validation","validationCode":"boolean exists = StorageProxy.iterateRangesFromTable(...) /* or simply */;\n// via Schema/ClusterMetadata on server-side tooling:\nif (ClusterMetadata.current().schema.getKeyspaces().getNullable(keyspace) == null)\n    fail(\"keyspace \" + keyspace + \" does not exist\");\n// via client: cqlsh -e 'DESCRIBE KEYSPACES' and grep","typeGuard":null,"tryCatchPattern":"try { ss.effectiveOwnership(ks); } catch (IllegalArgumentException e) { if (e.getMessage().endsWith(\"does not exist\")) { log.warn(\"typo or dropped keyspace: {}\", ks); } throw e; }","preventionTips":["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"],"tags":["keyspace","not-found","nodetool"],"backgroundTag":"resource-not-found","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T21:17:11.552Z"}