{"record":{"id":"baa2eb0ce98f934a","repo":"redis/redis-py","slug":"cluster-mode-is-not-enabled-on-this-node-baa2eb","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/cluster.py","lineNumber":2700,"sourceCode":"                            **kwargs,\n                        )\n                        if startup_node in self.startup_nodes.values():\n                            self.startup_nodes[startup_node.name].redis_connection = r\n                        else:\n                            startup_node.redis_connection = r\n                    try:\n                        # Make sure cluster mode is enabled on this node\n                        cluster_slots = str_if_bytes(r.execute_command(\"CLUSTER SLOTS\"))\n                        if disconnect_startup_nodes_pools:\n                            with r.connection_pool._lock:\n                                # take care to clear connections before we move on\n                                # mark all active connections for reconnect - they will be\n                                # reconnected on next use, but will allow current in flight commands to complete first\n                                r.connection_pool.update_active_connections_for_reconnect()\n                                # Needed to clear READONLY state when it is no longer applicable\n                                r.connection_pool.disconnect_free_connections()\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":2682,"sourceCodeEnd":2718,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/cluster.py#L2682-L2718","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nclient = RedisCluster(host='localhost', port=6379)  # standalone Redis\n\n// after (standalone server)\nfrom redis import Redis\nclient = Redis(host='localhost', port=6379)","handlingStrategy":"validation","validationCode":"import redis\n# Verify cluster mode is enabled before using RedisCluster\nstandalone = redis.Redis(host, port)\ntry:\n    info = standalone.cluster('INFO')\n    assert 'cluster_enabled:1' in info\nexcept redis.ResponseError:\n    raise RuntimeError('This server is not in cluster mode; use redis.Redis instead')","typeGuard":"def is_cluster_node(host: str, port: int) -> bool:\n    import redis\n    try:\n        info = redis.Redis(host, port).cluster('INFO')\n        return 'cluster_enabled:1' in info\n    except redis.ResponseError:\n        return False","tryCatchPattern":"from redis.exceptions import RedisClusterException\ntry:\n    client = RedisCluster(host, port)\nexcept RedisClusterException as e:\n    if 'Cluster mode is not enabled' in str(e):\n        from redis import Redis\n        client = Redis(host, port)  # fall back to standalone","preventionTips":["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."],"tags":["cluster-mode","initialization","standalone","configuration"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}