apache/cassandra · error · IllegalArgumentException

Unknown keyspace '{ksName}'

Error message

Unknown keyspace '{ksName}'

What it means

Thrown by StorageService.getPaxosBallotLowBound when Keyspace.open(ksName) returns null, meaning no keyspace with that name exists on this node. It is an IllegalArgumentException signaling a bad JMX/nodetool argument.

Source

Thrown at src/java/org/apache/cassandra/service/StorageService.java:5610

        logger.info("paxos repair {} via jmx", enabled ? "enabled" : "disabled");
    }

    public boolean getPaxosDcLocalCommitEnabled()
    {
        return PaxosCommit.getEnableDcLocalCommit();
    }

    public void setPaxosDcLocalCommitEnabled(boolean enabled)
    {
        PaxosCommit.setEnableDcLocalCommit(enabled);
        logger.info("paxos dc local commit {} via jmx", enabled ? "enabled" : "disabled");
    }

    public String getPaxosBallotLowBound(String ksName, String tblName, String key)
    {
        Keyspace keyspace = Keyspace.open(ksName);
        if (keyspace == null)
            throw new IllegalArgumentException("Unknown keyspace '" + ksName + "'");

        ColumnFamilyStore cfs = keyspace.getColumnFamilyStore(tblName);
        if (cfs == null)
            throw new IllegalArgumentException("Unknown table '" + tblName + "' in keyspace '" + ksName + "'");

        TableMetadata table = cfs.metadata.get();
        DecoratedKey dk = table.partitioner.decorateKey(table.partitionKeyType.fromString(key));
        return cfs.getPaxosRepairHistory().ballotForToken(dk.getToken()).toString();
    }

    public Long getRepairRpcTimeout()
    {
        return DatabaseDescriptor.getRepairRpcTimeout(MILLISECONDS);
    }

    public void setRepairRpcTimeout(Long timeoutInMillis)
    {
        checkState(timeoutInMillis > 0);

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Verify the keyspace name with `nodetool describecluster` or by running `DESCRIBE KEYSPACES` in cqlsh and correct the argument.
  2. Check case sensitivity: use the exact keyspace name (lowercase unless it was created quoted).
  3. Ensure the keyspace exists on the node being queried (schema agreement); recreate or repair schema if it is missing.

Example fix

// before
String ballot = ssProxy.getPaxosBallotLowBound("MyKS", "tbl", key); // throws if keyspace is 'myks'
// after
if (Schema.instance.isValidKeyspace("myks")) {
    String ballot = ssProxy.getPaxosBallotLowBound("myks", "tbl", key);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!StorageProxy.getNaturalEndpoints(ksName, /* any token */).isEmpty() == false) ... // better:
if (Schema.instance.getKeyspaceMetadata(ksName) == null) throw new IllegalArgumentException("keyspace does not exist: " + ksName);

Try / catch

try { return ssProxy.getPaxosBallotLowBound(ksName, tblName, key); }
catch (IllegalArgumentException e) { if (e.getMessage().startsWith("Unknown keyspace")) { /* resolve keyspace list */ } throw e; }

Prevention

When it happens

Trigger: Calling getPaxosBallotLowBound(ksName, tblName, key) (directly or via nodetool/JMX) with a keyspace name that is not present in Schema.instance, e.g. a typo or a keyspace dropped before the call.

Common situations: Typo in keyspace name; querying a keyspace that exists only on other nodes; case-sensitivity mistakes (Cassandra keyspaces are case-sensitive unless quoted); keyspace dropped between listing and querying.

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


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/9f5f458f10f3ad48. Report an issue: GitHub.