redis/node-redis · error · Error
Master Node Not Enumerated
Error message
Master Node Not Enumerated
What it means
Thrown by RedisSentinelFactory.getMasterNode() when `connected` is true (at least one sentinel accepted a connection) but parseNode(masterData) returned undefined for every sentinel tried (sentinel/index.ts:1757). So the sentinels are reachable but none could resolve a valid master for options.name — the master name is unknown to them or its record is unparseable.
Source
Thrown at packages/client/lib/sentinel/index.ts:1758
connected = true;
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
}
});
}
View on GitHub (pinned to bb5beb5657)
Solutions
- Run `sentinel masters` on a reachable sentinel and confirm options.name is listed with valid host/port.
- Fix the master name in RedisSentinelFactory options to match sentinel.conf exactly (case-sensitive).
- If the master record is malformed, check the sentinel health/version and re-add the monitor (`SENTINEL MONITOR`).
Defensive patterns
Strategy: validation
Validate before calling
// Confirm a reachable sentinel knows the master name before calling getMasterNode().
async function assertMasterKnown(sentinelNode, name) {
const c = createClient({ socket: sentinelNode });
c.on('error', () => {});
await c.connect();
try {
const masters = await c.sentinel.sentinelMasters();
const m = masters.find(x => x.name === name);
if (!m || !m.host || !m.port) throw new Error(`sentinel has no valid master for '${name}'`);
} finally {
await c.destroy();
}
} Try / catch
try {
const master = await factory.getMasterNode();
} catch (e) {
if (e instanceof Error && /Master Node Not Enumerated/.test(e.message)) {
// master name mismatch — recheck options.name against sentinel.conf
}
throw e;
} Prevention
- Source options.name from the same config as the sentinel's monitor directive.
- Run `SENTINEL MASTERS` during deploys to confirm the name/host/port are present.
- Centralize master-name config so client and sentinel cannot drift.
When it happens
Trigger: Calling getMasterNode() with options.name that the reachable sentinels do not monitor; sentinel returns a master record missing host/port or flagged such that parseNode rejects it.
Common situations: Mismatched master name between client config and sentinel.conf; pointing at a sentinel pool for a different deployment; sentinel recently reconfigured and the master record is empty.
Related errors
- no valid master node
- No Replicas Nodes Enumerated
- Client Side Caching is only supported with RESP3
- invalid nodeClientOptions for Sentinel
- invalid sentinelClientOptions for Sentinel
AI-assisted analysis of redis/node-redis@bb5beb5657 (2026-08-03).
Data as JSON: /data/errors/95df6e12348c0a3c.json.
Report an issue: GitHub.