{"record":{"id":"f7857ef35e84c5a5","repo":"redis/redis-py","slug":"cluster-mode-is-not-enabled-on-this-node","errorCode":null,"errorMessage":"Cluster mode is not enabled on this node","messagePattern":"Cluster mode is not enabled on this node","errorType":"exception","errorClass":"RedisClusterException","httpStatus":null,"severity":"critical","filePath":"redis/asyncio/cluster.py","lineNumber":2282,"sourceCode":"            for startup_node in chain(\n                startup_nodes,\n                additional_startup_nodes,\n                deferred_failed_nodes,\n            ):\n                try:\n                    # Make sure cluster mode is enabled on this node\n                    try:\n                        self._event_dispatcher.dispatch(\n                            AfterAsyncClusterInstantiationEvent(\n                                self.nodes_cache,\n                                self.connection_kwargs.get(\"credential_provider\", None),\n                            )\n                        )\n                        cluster_slots = await startup_node.execute_command(\n                            \"CLUSTER SLOTS\"\n                        )\n                    except ResponseError:\n                        raise RedisClusterException(\n                            \"Cluster mode is not enabled on this node\"\n                        )\n                    startup_nodes_reachable = True\n                except Exception as e:\n                    # Try the next startup node.\n                    # The exception is saved and raised only if we have no more nodes.\n                    exception = e\n                    continue\n\n                # CLUSTER SLOTS command results in the following output:\n                # [[slot_section[from_slot,to_slot,master,replica1,...,replicaN]]]\n                # where each node contains the following list: [IP, port, node_id]\n                # Therefore, cluster_slots[0][2][0] will be the IP address of the\n                # primary node of the first slot section.\n                # If there's only one server in the cluster, its ``host`` is ''\n                # Fix it to the host in startup_nodes\n                if (\n                    len(cluster_slots) == 1","sourceCodeStart":2264,"sourceCodeEnd":2300,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/asyncio/cluster.py#L2264-L2300","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Use redis.asyncio.Redis (standalone client) instead of RedisCluster for non-clustered Redis.","Ensure the Redis server is started with cluster-enabled yes (and the cluster*.conf/node config files are set up).","Double-check the host:port you pass to RedisCluster actually points at a cluster node, not a proxy or standalone instance.","Run redis-cli -h <host> -p <port> CLUSTER INFO and confirm cluster_enabled:1."],"exampleFix":"// before\nclient = RedisCluster(host='localhost', port=6379)  # 6379 is a standalone redis\n\n// after\nclient = RedisCluster(host='localhost', port=7000)  # a cluster-enabled node\n# or, for standalone:\nfrom redis.asyncio import Redis\nclient = Redis(host='localhost', port=6379)","handlingStrategy":"validation","validationCode":"async def assert_cluster_mode(host, port):\n    from redis.asyncio import Redis\n    r = Redis(host=host, port=port)\n    try:\n        info = await r.execute_command('CLUSTER', 'INFO')\n        if 'cluster_enabled:1' not in info.decode():\n            raise RuntimeError(f'{host}:{port} is not cluster-enabled')\n    finally:\n        await r.aclose()\n\nawait assert_cluster_mode('localhost', 7000)\nrc = RedisCluster(host='localhost', port=7000)","typeGuard":"null","tryCatchPattern":"from redis.exceptions import RedisClusterException\ntry:\n    rc = RedisCluster(host=host, port=port)\n    await rc.initialize()\nexcept RedisClusterException as e:\n    if 'Cluster mode is not enabled' in str(e):\n        from redis.asyncio import Redis\n        client = Redis(host=host, port=port)  # fall back to standalone","preventionTips":["Confirm cluster_enabled:1 via redis-cli CLUSTER INFO before constructing RedisCluster.","Use the standalone Redis client for non-cluster deployments.","Validate the endpoint type in CI/integration tests against the expected topology."],"tags":["cluster","configuration","standalone","init"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}