redis/node-redis · error · Error
Couldn't connect to any sentinel node
Error message
Couldn't connect to any sentinel node
What it means
Thrown by RedisSentinelFactory.updateSentinelRootNodes() after iterating this.#sentinelRootNodes and failing client.connect() on every one (sentinel/index.ts:1713). Unlike the internal observe path, this is a user-facing factory method that refreshes the seed-node list by asking one reachable sentinel for its peers; if none can be dialed it gives up.
Source
Thrown at packages/client/lib/sentinel/index.ts:1714
try {
await client.connect();
} catch {
if (client.isOpen) {
client.destroy();
}
continue;
}
try {
const sentinelData = await client.sentinel.sentinelSentinels(this.options.name);
this.#sentinelRootNodes = [node].concat(createNodeList(sentinelData));
return;
} finally {
client.destroy();
}
}
throw new Error("Couldn't connect to any sentinel node");
}
async getMasterNode() {
let connected = false;
for (const node of this.#sentinelRootNodes) {
const client = RedisClient.create({
...this.options.sentinelClientOptions,
socket: {
...this.options.sentinelClientOptions?.socket,
host: node.host,
port: node.port,
reconnectStrategy: false
},
modules: RedisSentinelModule
}).on('error', err => this.emit(`getMasterNode: ${err}`));
try {View on GitHub (pinned to bb5beb5657)
Solutions
- Verify each sentinelRootNodes host:port is dialable from the client (`redis-cli ... PING`).
- Correct sentinelClientOptions (password/TLS) so connect() succeeds against the sentinels.
- Add more redundant sentinel seeds so one is likely to be up.
- Catch the rejection and retry with backoff rather than treating it as fatal.
Defensive patterns
Strategy: retry
Validate before calling
// Reuse the same reachability helper as error 83 before calling updateSentinelRootNodes().
if (!(await anySentinelReachable(factory.options.sentinelRootNodes))) {
throw new Error('no sentinel seed reachable — skipping updateSentinelRootNodes()');
} Try / catch
async function refreshRoots(factory, attempts = 3) {
for (let i = 0; i < attempts; i++) {
try {
await factory.updateSentinelRootNodes();
return;
} catch (e) {
if (e instanceof Error && /Couldn't connect to any sentinel node/.test(e.message) && i < attempts - 1) {
await new Promise(r => setTimeout(r, 1000 * (i + 1)));
continue;
}
throw e;
}
}
} Prevention
- Verify sentinel seed reachability before refreshing roots.
- Keep redundant seeds so one is likely up.
- Catch and retry with backoff; treat updateSentinelRootNodes as best-effort.
When it happens
Trigger: Calling factory.updateSentinelRootNodes() when all configured sentinel seed nodes are unreachable or reject the connection.
Common situations: Refresh triggered after a network blip or during a full sentinel outage; wrong seed host/port in RedisSentinelFactory options; sentinelClientOptions auth wrong so every connect() throws.
Related errors
- couldn't connect to any sentinels
- None of the sentinels are available
- Master Node Not Enumerated
- No Replicas Nodes Enumerated
- no available replicas
AI-assisted analysis of redis/node-redis@bb5beb5657 (2026-08-03).
Data as JSON: /data/errors/4b4c5d63792030d1.json.
Report an issue: GitHub.