redis/jedis · critical · JedisClusterOperationException
No cluster nodes available.
Error message
No cluster nodes available.
What it means
RoundRobinConnectionResolver selects the pool of node connections used for cluster-wide (broadcast or read-from-replica) commands. It throws JedisClusterOperationException("No cluster nodes available.") when the map of primary (or replica, for reads) node connections is empty. It means the client cannot find any eligible cluster node to route to.
Solutions
- If using read-from-replica, switch to reading from primaries (or configure at least one replica per master).
- Verify cluster topology with `redis-cli cluster nodes` — ensure masters exist and slots are assigned.
- Check that the startup node addresses in the client builder point to live cluster nodes and topology refresh is working.
- Wait for/repair failed nodes so the connection map repopulates.
Example fix
// before client.setReadFrom(ReadFrom.REPLICA); // cluster has no replicas // after client.setReadFrom(ReadFrom.PRIMARY); // or add a replica: redis-cli --cluster add-node <replica>:6379 <master>:6379 --cluster-slave
Defensive patterns
Strategy: validation
Validate before calling
Map<String, ConnectionPool> nodes = provider.getPrimaryNodesConnectionMap();
if (nodes == null || nodes.isEmpty()) {
throw new IllegalStateException("no cluster nodes configured; check startup nodes and topology");
} Try / catch
try {
return broadcastCommand();
} catch (JedisClusterOperationException e) {
if (e.getMessage().contains("No cluster nodes available")) {
refreshTopology();
return broadcastCommand();
}
throw e;
} Prevention
- Configure multiple startup nodes pointing at live masters
- Match ReadFrom setting to actual replica topology
- Run `cluster nodes` checks before deployments
- Enable automatic topology refresh
When it happens
Trigger: A keyless/broadcast command requiring primary nodes while the cluster reports no primaries; a read command routed to replicas when the connection map for replicas is empty (no replicas configured or all replica nodes unreachable/unregistered).
Common situations: Cluster with zero replicas while reading from replicas (misconfigured fromReplica/readFrom settings); node list empty because the topology hasn't been refreshed or all nodes are down; wrong startup nodes pointing at a dead 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
- Support only execute to replica in ClusterCommandExecutor
- Topology refresh period cannot be negative for cluster mode
- setHostAndPort method has limited capability.
- Command '' with request policy cannot be executed in…
- Support only execute to replica in ClusterCommandExecutor
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/28387bde456a96e5.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/executors/RoundRobinConnectionResolver.java:63
ConnectionPool pool = selectedEntry.getValue();
return pool.getResource();
}
private List<Map.Entry<String, ConnectionPool>> selectConnectionPool(
ConnectionResolver.ConnectionIntent intent) {
Map<String, ConnectionPool> connectionMap;
if (intent == ConnectionResolver.ConnectionIntent.READ) {
// For keyless READ commands, use all nodes for load distribution
connectionMap = provider.getConnectionMap();
} else {
// Write operations always go to primary nodes
connectionMap = provider.getPrimaryNodesConnectionMap();
}
if (connectionMap.isEmpty()) {
throw new JedisClusterOperationException("No cluster nodes available.");
}
return new ArrayList<>(connectionMap.entrySet());
}
}
View on GitHub (pinned to 6dac31d4c2)