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 during initialize() when CLUSTER SLOTS on a startup node returns a ResponseError. That error means the target Redis is not running in cluster mode, so the RedisCluster client cannot build a slot map from it.

Solutions

  1. Use redis.asyncio.Redis (standalone client) instead of RedisCluster for non-clustered Redis.
  2. Ensure the Redis server is started with cluster-enabled yes (and the cluster*.conf/node config files are set up).
  3. Double-check the host:port you pass to RedisCluster actually points at a cluster node, not a proxy or standalone instance.
  4. Run redis-cli -h <host> -p <port> CLUSTER INFO and confirm cluster_enabled:1.

Example fix

// before
client = RedisCluster(host='localhost', port=6379)  # 6379 is a standalone redis

// after
client = RedisCluster(host='localhost', port=7000)  # a cluster-enabled node
# or, for standalone:
from redis.asyncio import Redis
client = Redis(host='localhost', port=6379)
Defensive patterns

Strategy: validation

Validate before calling

async def assert_cluster_mode(host, port):
    from redis.asyncio import Redis
    r = Redis(host=host, port=port)
    try:
        info = await r.execute_command('CLUSTER', 'INFO')
        if 'cluster_enabled:1' not in info.decode():
            raise RuntimeError(f'{host}:{port} is not cluster-enabled')
    finally:
        await r.aclose()

await assert_cluster_mode('localhost', 7000)
rc = RedisCluster(host='localhost', port=7000)

Type guard

null

Try / catch

from redis.exceptions import RedisClusterException
try:
    rc = RedisCluster(host=host, port=port)
    await rc.initialize()
except RedisClusterException as e:
    if 'Cluster mode is not enabled' in str(e):
        from redis.asyncio import Redis
        client = Redis(host=host, port=port)  # fall back to standalone

Prevention

When it happens

Trigger: Pointing a RedisCluster client at a standalone (non-cluster) Redis instance, or at a Redis that has cluster-mode disabled (cluster-enabled no in config). The execute_command('CLUSTER SLOTS') call returns an error response.

Common situations: Misconfigured endpoint (load balancer pointing at a standalone Redis), local dev with plain redis-server instead of redis-server --cluster-enabled yes, or connecting to a Sentinel/standalone URL with the cluster client.

Related errors


AI-assisted analysis of redis/redis-py@6a6b581b48 (2026-08-10). Data as JSON: /api/errors/f7857ef35e84c5a5. Report an issue: GitHub.

Appendix: source

Thrown at redis/asyncio/cluster.py:2282

            for startup_node in chain(
                startup_nodes,
                additional_startup_nodes,
                deferred_failed_nodes,
            ):
                try:
                    # Make sure cluster mode is enabled on this node
                    try:
                        self._event_dispatcher.dispatch(
                            AfterAsyncClusterInstantiationEvent(
                                self.nodes_cache,
                                self.connection_kwargs.get("credential_provider", None),
                            )
                        )
                        cluster_slots = await startup_node.execute_command(
                            "CLUSTER SLOTS"
                        )
                    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) == 1

View on GitHub (pinned to 6a6b581b48)