redis/node-redis · critical · Error
couldn't connect to any sentinels
Error message
couldn't connect to any sentinels
What it means
Thrown by RedisSentinelFactory.getMasterNode() when `connected` stayed false — client.connect() failed for every node in #sentinelRootNodes (sentinel/index.ts:1761). Distinct from error 86: here we never reached a sentinel at all, so we could not even ask for the master.
Source
Thrown at packages/client/lib/sentinel/index.ts:1761
try {
const masterData = await client.sentinel.sentinelMaster(this.options.name);
const master = parseNode(masterData);
if (master === undefined) {
continue;
}
return master;
} finally {
client.destroy();
}
}
if (connected) {
throw new Error("Master Node Not Enumerated");
}
throw new Error("couldn't connect to any sentinels");
}
async getMasterClient() {
const master = await this.getMasterNode();
const socket = getMappedNode(master.host, master.port, this.options.nodeAddressMap);
return RedisClient.create({
...this.options.nodeClientOptions,
socket: {
...this.options.nodeClientOptions?.socket,
host: socket.host,
port: socket.port
}
});
}
async getReplicaNodes() {
let connected = false;
View on GitHub (pinned to bb5beb5657)
Solutions
- Confirm sentinel seed host:port reachability from the client host.
- Fix sentinelClientOptions auth/TLS to match the sentinels.
- Provide redundant sentinel seeds across hosts/AZs.
- Retry getMasterNode() with backoff during transient outages.
Defensive patterns
Strategy: retry
Validate before calling
// Same reachability pre-check as errors 83/85 before calling getMasterNode().
if (!(await anySentinelReachable(factory.options.sentinelRootNodes))) {
throw new Error('no sentinel reachable — cannot resolve master');
} Try / catch
async function getMasterWithRetry(factory, attempts = 5) {
for (let i = 0; i < attempts; i++) {
try {
return await factory.getMasterNode();
} catch (e) {
if (e instanceof Error && /couldn't connect to any sentinels/.test(e.message) && i < attempts - 1) {
await new Promise(r => setTimeout(r, 1000 * (i + 1)));
continue;
}
throw e;
}
}
} Prevention
- Verify sentinel seed ports/auth before resolving the master.
- Keep redundant seeds across AZs.
- Retry with backoff during transient network issues.
When it happens
Trigger: Calling getMasterNode() when all sentinel seeds are unreachable (network, wrong port, auth/TLS failure).
Common situations: Initial bootstrap against a misconfigured seed list; firewall blocking 26379; sentinelClientOptions password mismatch with requirepass; DNS not resolving the sentinel hostnames.
Related errors
- Couldn't connect to any sentinel node
- 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/ddbddb5e4168a320.json.
Report an issue: GitHub.