redis/redis-py · critical · RedisClusterException
Cluster mode is not enabled on this node
Error message
Cluster mode is not enabled on this node
What it means
Raised as a RedisClusterException during initial topology discovery when executing CLUSTER SLOTS on a startup node raises a ResponseError. A ResponseError to CLUSTER SLOTS means the node is not running in cluster mode (it is a standalone Redis instance). The catch at cluster.py:2699-2702 converts this into a clear error. This is raised per-node and only surfaces if no other startup node succeeds.
Solutions
- Use redis.Redis (standalone client) instead of RedisCluster if the server is not in cluster mode.
- Enable cluster mode in redis.conf by setting 'cluster-enabled yes' and restart the Redis server.
- Verify with redis-cli -h host -p port CLUSTER INFO that the node reports cluster_enabled:1.
Example fix
// before client = RedisCluster(host='localhost', port=6379) # standalone Redis // after (standalone server) from redis import Redis client = Redis(host='localhost', port=6379)
Defensive patterns
Strategy: validation
Validate before calling
import redis
# Verify cluster mode is enabled before using RedisCluster
standalone = redis.Redis(host, port)
try:
info = standalone.cluster('INFO')
assert 'cluster_enabled:1' in info
except redis.ResponseError:
raise RuntimeError('This server is not in cluster mode; use redis.Redis instead') Type guard
def is_cluster_node(host: str, port: int) -> bool:
import redis
try:
info = redis.Redis(host, port).cluster('INFO')
return 'cluster_enabled:1' in info
except redis.ResponseError:
return False Try / catch
from redis.exceptions import RedisClusterException
try:
client = RedisCluster(host, port)
except RedisClusterException as e:
if 'Cluster mode is not enabled' in str(e):
from redis import Redis
client = Redis(host, port) # fall back to standalone Prevention
- Confirm cluster mode is enabled (cluster-enabled yes in redis.conf) before using RedisCluster.
- Run CLUSTER INFO to verify cluster_enabled:1.
- Use redis.Redis for standalone servers; use RedisCluster only for actual clusters.
When it happens
Trigger: Constructing RedisCluster(host, port) where host:port points to a standalone (non-cluster) Redis server. The client tries CLUSTER SLOTS, gets a ResponseError (ERR This instance has cluster support disabled), and wraps it.
Common situations: Developer uses RedisCluster against a single standalone Redis instance, or the cluster-mode-enabled setting (cluster-enabled yes) was not set in redis.conf, or connecting through a proxy that strips cluster commands.
Related errors
- Cluster mode is not enabled on this node
- All slots are not covered after query all startup_nodes.
- Argument 'db' must be 0 or None in cluster mode
- Cache must implement CacheInterface
- Cannot disable maintenance notifications after enabling them
AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10).
Data as JSON: /api/errors/baa2eb0ce98f934a.
Report an issue: GitHub.
Appendix: source
Thrown at redis/cluster.py:2700
**kwargs,
)
if startup_node in self.startup_nodes.values():
self.startup_nodes[startup_node.name].redis_connection = r
else:
startup_node.redis_connection = r
try:
# Make sure cluster mode is enabled on this node
cluster_slots = str_if_bytes(r.execute_command("CLUSTER SLOTS"))
if disconnect_startup_nodes_pools:
with r.connection_pool._lock:
# take care to clear connections before we move on
# mark all active connections for reconnect - they will be
# reconnected on next use, but will allow current in flight commands to complete first
r.connection_pool.update_active_connections_for_reconnect()
# Needed to clear READONLY state when it is no longer applicable
r.connection_pool.disconnect_free_connections()
except ResponseError:
raise RedisClusterException(
"Cluster mode is not enabled on this node"
)
startup_nodes_reachable = True
except Exception as e:
# Try the next startup node.
# The exception is saved and raised only if we have no more nodes.
exception = e
continue
# CLUSTER SLOTS command results in the following output:
# [[slot_section[from_slot,to_slot,master,replica1,...,replicaN]]]
# where each node contains the following list: [IP, port, node_id]
# Therefore, cluster_slots[0][2][0] will be the IP address of the
# primary node of the first slot section.
# If there's only one server in the cluster, its ``host`` is ''
# Fix it to the host in startup_nodes
if (
len(cluster_slots) == 1View on GitHub (pinned to 6a6b581b48)