apache/cassandra · error · ConfigurationException
Allocated token %s already assigned to node %s. Is another n
Error message
Allocated token %s already assigned to node %s. Is another node also allocating tokens?
What it means
TokenAllocation throws ConfigurationException when a token chosen by the allocator is already owned by another node in the same allocation ring (same datacenter/rack scope). It indicates two nodes are allocating tokens concurrently or a racing allocation has claimed the same token.
Source
Thrown at src/java/org/apache/cassandra/dht/tokenallocator/TokenAllocation.java:187
InetAddressAndPort endpoint = metadata.directory.endpoint(en.getValue());
if (inAllocationRing(metadata.locator, endpoint))
sortedTokens.put(en.getKey(), endpoint);
}
return TokenAllocatorFactory.createTokenAllocator(sortedTokens, this, metadata.tokenMap.partitioner());
}
final Collection<Token> adjustForCrossDatacenterClashes(Collection<Token> tokens)
{
List<Token> filtered = Lists.newArrayListWithCapacity(tokens.size());
for (Token t : tokens)
{
while (metadata.tokenMap.owner(t) != null)
{
NodeId nodeId = metadata.tokenMap.owner(t);
InetAddressAndPort other = metadata.directory.endpoint(nodeId);
if (inAllocationRing(metadata.locator, other))
throw new ConfigurationException(String.format("Allocated token %s already assigned to node %s. Is another node also allocating tokens?", t, other));
t = t.nextValidToken();
}
filtered.add(t);
}
return filtered;
}
final SummaryStatistics replicatedOwnershipStats()
{
SummaryStatistics stat = new SummaryStatistics();
for (Map.Entry<InetAddressAndPort, Double> en : evaluateReplicatedOwnership().entrySet())
{
// Filter only in the same allocation ring
if (inAllocationRing(metadata.locator, en.getKey()))
{
NodeId nodeId = metadata.directory.peerId(en.getKey());
stat.addValue(en.getValue() / metadata.tokenMap.tokens(nodeId).size());
}View on GitHub (pinned to 88fd0f6a0e)
Solutions
- Retry the node bootstrap after the other allocation completes (serialize node joins)
- Ensure only one node allocates tokens at a time — use deterministic ordering in provisioning scripts
- Check nodetool ring for the conflicting token owner and choose a different token/bootstrap order
- If metadata is stale, wait for gossip convergence and retry
Example fix
// before: two nodes bootstrap in parallel ansible all -m cassandra_bootstrap # race -> ConfigurationException // after: join nodes sequentially - hosts: cassandra[0] tasks: [bootstrap node] - hosts: cassandra[1] tasks: [bootstrap next node after previous is Up/Normal]
Defensive patterns
Strategy: retry
Validate before calling
// before bootstrapping a new node, confirm no other node is currently bootstrapping nodetool status # no 'UJ' (Up/Joining) nodes // and confirm the candidate tokens are unowned in nodetool ring
Try / catch
try {
TokenAllocation.allocate(metadata, ks, dc);
} catch (ConfigurationException e) {
if (e.getMessage().contains("already assigned")) {
// backoff and retry once other node finished joining
}
} Prevention
- Bootstrap nodes sequentially, not in parallel
- Use provisioning tooling that serializes token allocation
- Wait for previous bootstrap to reach Up/Normal before starting next
- Monitor for UJ state in nodetool status
When it happens
Trigger: Calling allocate when, during adjustForCrossDatacenterClashes, metadata.tokenMap.owner(token) returns a non-null node that is inAllocationRing — i.e. the token is taken by another node in the same DC.
Common situations: Two or more nodes bootstrapping simultaneously with token allocation enabled; a node bootstrapping while another allocation just finished; clustered automated provisioning racing across nodes.
Related errors
- Queue is empty
- UnsupportedOperationException
- Maximum pool size has been changed while resizing
- Must be one of ${values}
- ${executor} has shut down
AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10).
Data as JSON: /api/errors/dad6ec3433ec2ccc.
Report an issue: GitHub.