{"record":{"id":"696b74c00465c3af","repo":"redis/redis-py","slug":"redis-cluster-cannot-be-connected-please-provide","errorCode":null,"errorMessage":"Redis Cluster cannot be connected. Please provide at least one reachable node: {str(exception)}","messagePattern":"Redis Cluster cannot be connected\\. Please provide at least one reachable node: (.+?)","errorType":"exception","errorClass":"RedisClusterException","httpStatus":null,"severity":"critical","filePath":"redis/asyncio/cluster.py","lineNumber":2372,"sourceCode":"                                )\n\n                                if len(disagreements) > 5:\n                                    raise RedisClusterException(\n                                        f\"startup_nodes could not agree on a valid \"\n                                        f\"slots cache: {', '.join(disagreements)}\"\n                                    )\n\n                # Validate if all slots are covered or if we should try next startup node\n                fully_covered = True\n                for i in range(REDIS_CLUSTER_HASH_SLOTS):\n                    if i not in tmp_slots:\n                        fully_covered = False\n                        break\n                if fully_covered:\n                    break\n\n            if not startup_nodes_reachable:\n                raise RedisClusterException(\n                    f\"Redis Cluster cannot be connected. Please provide at least \"\n                    f\"one reachable node: {str(exception)}\"\n                ) from exception\n\n            # Check if the slots are not fully covered\n            if not fully_covered and self.require_full_coverage:\n                # Despite the requirement that the slots be covered, there\n                # isn't a full coverage\n                raise RedisClusterException(\n                    f\"All slots are not covered after query all startup_nodes. \"\n                    f\"{len(tmp_slots)} of {REDIS_CLUSTER_HASH_SLOTS} \"\n                    f\"covered...\"\n                )\n\n            # Set the tmp variables to the real variables\n            self.set_nodes(self.nodes_cache, tmp_nodes_cache, remove_old=True)\n            # tmp_slots was built from CLUSTER SLOTS responses and can contain\n            # newly-created ClusterNode objects for nodes we already know about.","sourceCodeStart":2354,"sourceCodeEnd":2390,"githubUrl":"https://github.com/redis/redis-py/blob/6a6b581b48225afa0b76912d1028c6035baee932/redis/asyncio/cluster.py#L2354-L2390","documentation":"Raised at the end of initialize() when none of the startup nodes (plus any additional_startup_nodes) could be contacted. The original connection exception is included so you can see the underlying socket/auth/timeout cause.","triggerScenarios":"All startup_nodes are unreachable: wrong host/port, network partition, firewall, TLS mismatch, auth failure, or every node is down. startup_nodes_reachable stays False and the last exception bubbles up.","commonSituations":"DNS resolving to a dead endpoint; security group / firewall blocking the port; AUTH/ACL password wrong so every node rejects the connection; client pointed at the wrong environment.","solutions":["Confirm network reachability: telnet/nc to host:port from the client host.","Verify host and port values and that the cluster nodes are actually running.","Check credentials: if AUTH is required, pass password=/credential_provider= matching the cluster's ACL.","For TLS clusters, ensure ssl=True and correct ca_certs; for plaintext, ensure ssl is not forced.","Inspect str(exception) in the message for the real cause (timeout vs auth vs connection refused)."],"exampleFix":"// before\nrc = RedisCluster(host='redis-prod', port=6379)  # wrong host/port\n\n// after\nrc = RedisCluster(host='redis-prod', port=7000, password=os.environ['REDIS_PW'])\n# verify first:\n# nc -zv redis-prod 7000","handlingStrategy":"try-catch","validationCode":"import socket\n\ndef reachable(host, port, timeout=2):\n    try:\n        with socket.create_connection((host, port), timeout=timeout):\n            return True\n    except OSError:\n        return False\n\nif not all(reachable(h, p) for h, p in seeds):\n    raise RuntimeError('Some cluster seed nodes unreachable')\nrc = RedisCluster(startup_nodes=[ClusterNode(h, p) for h, p in seeds])","typeGuard":"null","tryCatchPattern":"from redis.exceptions import RedisClusterException\nimport asyncio\nfor attempt in range(5):\n    try:\n        await rc.initialize()\n        break\n    except RedisClusterException as e:\n        if 'cannot be connected' not in str(e):\n            raise\n        await asyncio.sleep(min(2 ** attempt, 30))\nelse:\n    raise","preventionTips":["Pre-flight check TCP reachability to every seed host:port.","Verify AUTH/ACL credentials match the cluster before constructing RedisCluster.","Confirm TLS settings (ssl/ca_certs) match the endpoint.","Read the embedded str(exception) to distinguish auth vs network vs timeout."],"tags":["network","cluster","connectivity","init","auth"],"backgroundTag":null,"analyzedSha":"6a6b581b48225afa0b76912d1028c6035baee932","analyzedAt":"2026-08-10T12:52:44.840Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}