{"record":{"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":754,"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":736,"sourceCodeEnd":772,"githubUrl":"https://github.com/redis/node-redis/blob/90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58/packages/client/lib/cluster/index.ts#L736-L772","documentation":"Thrown when an ASK redirect names a node address that cannot be found in the cluster topology, even after a fresh rediscovery attempt via slots.rediscover(). The node that the ASK message points to either left the cluster or its address format doesn't match any known node. The client cannot determine where to send the command.","triggerScenarios":"During failover, the old master's address appears in the ASK response but the new topology (after rediscovery) no longer lists it; the node crashed and was removed from the cluster while the command was in-flight; address format mismatch (e.g. hostname vs IP, or missing port) between the ASK payload and the slots table.","commonSituations":"Node crash during command execution; network partition where some nodes report a topology the client never converges on; DNS-based node addresses that resolve differently across calls; cluster reconfiguration (node removal) while traffic is flowing.","solutions":["Retry the command — by the next attempt the topology may have stabilized and MOVED (not ASK) will resolve the new owner","Verify the node address from the error is present in CLUSTER NODES output on the seed nodes","Ensure all cluster nodes use consistent address formats (all IP:port, not mixed hostname and IP)","Check for ongoing failover events and wait for cluster state to return to ok"],"exampleFix":"// The error is transient — wrap cluster commands in a retry helper\nasync function withRetry<T>(fn: () => Promise<T>, retries = 3): Promise<T> {\n  try {\n    return await fn();\n  } catch (err) {\n    if (retries > 0 && err instanceof Error && err.message.startsWith('Cannot find node')) {\n      await new Promise(r => setTimeout(r, 500));\n      return withRetry(fn, retries - 1);\n    }\n    throw err;\n  }\n}\n\n// usage\nawait withRetry(() => cluster.get('mykey'));","handlingStrategy":"retry","validationCode":null,"typeGuard":"function isNodeNotFound(err: unknown): boolean {\n  return err instanceof Error && err.message.startsWith('Cannot find node');\n}","tryCatchPattern":"async function withNodeRetry<T>(fn: () => Promise<T>, retries = 3): Promise<T> {\n  try {\n    return await fn();\n  } catch (err) {\n    if (retries > 0 && err instanceof Error && err.message.startsWith('Cannot find node')) {\n      await new Promise(r => setTimeout(r, 500));\n      return withNodeRetry(fn, retries - 1);\n    }\n    throw err;\n  }\n}","preventionTips":["Monitor cluster node health and failover events","Ensure all cluster nodes use consistent address formats (IP:port, not mixed hostnames)","Keep rootNodes configuration in sync with actual cluster membership"],"tags":["cluster","redirection","failover","topology"],"backgroundTag":null,"analyzedSha":"90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58","analyzedAt":"2026-08-11T15:37:21.243Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}