{"id":"171edc04655c5a2d","repo":"redis/node-redis","slug":"cannot-find-node-address","errorCode":null,"errorMessage":"Cannot find node ${address}","messagePattern":"Cannot find node (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/client/lib/cluster/index.ts","lineNumber":747,"sourceCode":"          }\n\n          if (err.message.startsWith('ASK')) {\n            publish(CHANNELS.ERROR, () => ({\n              error: err,\n              origin: 'cluster',\n              internal: true,\n              clientId: client._clientId,\n              retryCount: i,\n            }));\n            const address = err.message.substring(err.message.lastIndexOf(' ') + 1);\n            let redirectTo = await this._slots.getMasterByAddress(address);\n            if (!redirectTo) {\n              await this._slots.rediscover(client);\n              redirectTo = await this._slots.getMasterByAddress(address);\n            }\n\n            if (!redirectTo) {\n              throw new Error(`Cannot find node ${address}`);\n            }\n\n            client = redirectTo;\n            myFn = this._handleAsk(fn);\n            continue;\n          }\n\n          if (err.message.startsWith('MOVED')) {\n            publish(CHANNELS.ERROR, () => ({\n              error: err,\n              origin: 'cluster',\n              internal: true,\n              clientId: client._clientId,\n              retryCount: i,\n            }));\n            await this._slots.rediscover(client);\n            client = (await this._slots.getClientAndSlotNumber(parser.firstKey, isReadonly)).client;\n            continue;","sourceCodeStart":729,"sourceCodeEnd":765,"githubUrl":"https://github.com/redis/node-redis/blob/bb5beb56578573910e2ee8f39681edc214c41398/packages/client/lib/cluster/index.ts#L729-L765","documentation":"Thrown inside the ASK-redirect handler in `_execute`: the server returned `ASK <slot> <ip:port>`, but `slots.getMasterByAddress(address)` could not resolve that address to a known node even after a `rediscover` round. The client will not guess which node serves the slot, so it surfaces the unresolvable address. This is a transient cluster-topology gap during resharding/migration.","triggerScenarios":"A command receives an ASK redirect (slot is being migrated to a new master), the target address is not in `nodeByAddress`, and rediscovery from the current node still does not learn it. Bounded by `maxCommandRedirections` (default 16) — repeated failures to resolve the ASK target eventually rethrow this.","commonSituations":"Heavy resharding or a failover where the new master's address has not propagated to the node the client asked; a node joining the cluster on an address the client's seed list can't reach for CLUSTER SLOTS/SHARDS; network partition isolating the migration target.","solutions":["Retry the command — rediscovery is lazy and a subsequent attempt usually has the target in topology.","Raise `maxCommandRedirections` if you legitimately have long migration chains, but treat persistent failures as a real topology problem.","Ensure all cluster node addresses in CLUSTER SLOTS/SHARDS are routable from the client host (no NAT/private-IP mismatch).","If persistent, verify cluster health with `redis-cli --cluster check` — a node that the cluster references but no member can reach causes this."],"exampleFix":"// before\nawait cluster.set('{usr:1}:name', 'alice'); // intermittent 'Cannot find node 10.0.0.7:6379'\n\n// after — retry transient ASK-resolution failures\nasync function resilientSet(k, v, attempts = 5) {\n  for (let i = 0; i < attempts; i++) {\n    try { return await cluster.set(k, v); }\n    catch (e) { if (i === attempts - 1 || !/Cannot find node/.test(e.message)) throw e; }\n  }\n}","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function withAskRetry(cluster, fn, attempts = 5) {\n  for (let i = 0; i < attempts; i++) {\n    try {\n      return await fn();\n    } catch (e) {\n      if (i === attempts - 1 || !/Cannot find node/.test(e.message)) throw e;\n      // rediscovery is lazy; give the topology a moment to repopulate\n    }\n  }\n}","preventionTips":["Ensure all cluster node addresses reported by CLUSTER SLOTS/SHARDS are routable from the client host (avoid NAT/private-IP mismatches).","During planned resharding, expect transient ASK-resolution gaps and wrap commands in a bounded retry.","Keep `maxCommandRedirections` at its default; raising it only masks a real topology problem.","Monitor cluster health — persistent 'Cannot find node' indicates a node the cluster references but cannot reach."],"tags":["cluster","topology","ask-redirect","resharding","routing"],"analyzedSha":"bb5beb56578573910e2ee8f39681edc214c41398","analyzedAt":"2026-08-03T19:09:15.686Z","schemaVersion":2}