redis/node-redis · error · TypeError
HOTKEYS GET: expected slot to be a finite number, got
Error message
HOTKEYS GET: expected slot to be a finite number, got ${JSON.stringify(value)} What it means
While transforming the HOTKEYS GET reply, a value in the selected-slots field could not be converted to a finite number. The toSlotNumber helper calls Number(value) and rejects non-finite results (NaN, Infinity, non-numeric strings, null). This indicates the server's reply schema differs from what the client expects.
Solutions
- Verify the Redis server version supports HOTKEYS GET with the expected reply schema
- Check if a proxy (Twemproxy, Redis Cluster Proxy) is reformatting the reply
- Capture the raw reply via sendCommand to inspect the actual selected-slots payload
- Report the issue with server version and raw reply for schema investigation
Defensive patterns
Strategy: try-catch
Try / catch
try {
const reply = await client.hotkeysGet();
// process reply
} catch (e) {
if (e instanceof TypeError && e.message.includes('HOTKEYS GET')) {
// Server reply schema mismatch — check server version and proxy configuration
console.error('HOTKEYS GET reply parsing failed:', e.message);
}
} Prevention
- Verify the Redis server version supports HOTKEYS GET with the expected reply schema
- Check for proxies or intermediaries that may reformat the reply
- Inspect the raw reply via sendCommand(['HOTKEYS','GET']) to diagnose schema differences
When it happens
Trigger: The server's HOTKEYS GET reply contains a selected-slots entry where a slot or slot-range endpoint is non-numeric — null, a string, or an unexpected nested type.
Common situations: Redis server version mismatch (older or newer HOTKEYS GET schema); a proxy or intermediary reformatting the reply; server bug producing a malformed selected-slots field.
Related errors
AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11).
Data as JSON: /api/errors/bae7c1f5808de9b5.
Report an issue: GitHub.
Appendix: source
Thrown at packages/client/lib/commands/HOTKEYS_GET.ts:50
allCommandsAllSlotsUs: number;
/** Only present when sample-ratio > 1 AND selected-slots is not empty */
netBytesSampledCommandsSelectedSlots?: number;
/** Only present when selected-slots is not empty */
netBytesAllCommandsSelectedSlots?: number;
netBytesAllCommandsAllSlots: number;
collectionStartTimeUnixMs: number;
collectionDurationMs: number;
totalCpuTimeSysMs: number;
totalCpuTimeUserMs: number;
totalNetBytes: number;
byCpuTimeUs?: Array<HotkeyEntry>;
byNetBytes?: Array<HotkeyEntry>;
}
function toSlotNumber(value: unknown): number {
const slot = Number(value);
if (!Number.isFinite(slot)) {
throw new TypeError(
`HOTKEYS GET: expected slot to be a finite number, got ${JSON.stringify(value)}`
);
}
return slot;
}
/**
* Parse the hotkeys array into HotkeyEntry objects
*/
function parseHotkeysList(arr: unknown): Array<HotkeyEntry> {
return mapLikeEntries(arr).map(([key, value]) => ({
key,
value: Number(value)
}));
}
/**
* Parse slot ranges from the server response.View on GitHub (pinned to 90fd0652bc)