apache/cassandra · error
Key %s in sstable %s not owned by local ranges %s
Error message
Key %s in sstable %s not owned by local ranges %s
What it means
During nodetool verify, verifySSTable validates every key in the sstable's index against the token ranges this node owns (rangeOwnHelper.validate). A key outside local ranges is warned (with the key, sstable, and owned ranges), recorded, and — per verify's fail-fast policy — marked and the original Throwable rethrown at the end, making verification fail. It detects misplaced sstable data, often after topology changes or misrestored files.
Source
Thrown at src/java/org/apache/cassandra/io/sstable/format/SortedTableVerifier.java:311
DecoratedKey key = null;
try
{
key = sstable.decorateKey(ByteBufferUtil.readWithShortLength(dataFile));
}
catch (Throwable th)
{
markAndThrow(th);
}
if (options.checkOwnsTokens && ownedRanges.size() > 0 && !(cfs.getPartitioner() instanceof LocalPartitioner))
{
try
{
rangeOwnHelper.validate(key);
}
catch (Throwable t)
{
outputHandler.warn(t, "Key %s in sstable %s not owned by local ranges %s", key, sstable, ownedRanges);
markAndThrow(t);
}
}
ByteBuffer currentIndexKey = indexIterator.key();
long nextRowPositionFromIndex = 0;
try
{
nextRowPositionFromIndex = indexIterator.advance()
? indexIterator.dataPosition()
: dataFile.length();
}
catch (Throwable th)
{
markAndThrow(th);
}
long dataStart = dataFile.getFilePointer();View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Remove or relocate the misplaced sstable (nodetool decommission/cleanup semantics): run nodetool cleanup to drop keys not owned locally
- If the sstable was restored from another node, restore from a snapshot belonging to this node instead
- Check cassandra.yaml token configuration (initial_token, num_tokens) matches the ring; run a full ring repair after topology changes
- Re-run nodetool verify after cleanup to confirm the ring is consistent
Example fix
// operator fix, not code nodetool cleanup # drop keys this node no longer owns nodetool verify # re-check
Defensive patterns
Strategy: validation
Validate before calling
// Before verify, confirm node ownership covers sstable tokens:
for (DecoratedKey k : sampledKeys) {
if (!StorageService.instance.getLocalRanges(keyspace).stream()
.anyMatch(r -> r.contains(k.getToken())))
throw new IllegalStateException("Key " + k + " not owned locally; run nodetool cleanup");
} Try / catch
try { verifier.verify(sstable); } catch (Throwable t) { logger.error("verify failed: sstable holds out-of-range keys", t); scheduleCleanup(); } Prevention
- Run nodetool cleanup after any topology change (bootstrap/decommission/token change)
- Never copy sstables between nodes with different token ownership
- Keep initial_token/num_tokens configuration consistent and documented
- Run verify after restores and ring changes
When it happens
Trigger: Running nodetool verify (with extended verification) on a node where an sstable contains a key whose token is not in the node's current local ranges; validate() throws and markAndThrow(t) schedules the failure.
Common situations: Sstables copied/restored from another node or datacenter; token/ring changes after bootstrapping, decommissioning, or a wrong initial_token/num_tokens config; running verify on a node whose ownership shifted mid-operation.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Index summary component of sstable
- Error occurred during verifying
- SSTable format name in %s cannot be null
- SSTable format name for %s must be non-empty, lower-case let
- Multiple sstable format implementations with the same name %
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/26d85479f0cebbdf.
Report an issue: GitHub.