{"id":"bae7c1f5808de9b5","repo":"redis/node-redis","slug":"hotkeys-get-expected-slot-to-be-a-finite-number","errorCode":null,"errorMessage":"HOTKEYS GET: expected slot to be a finite number, got ${JSON.stringify(value)}","messagePattern":"HOTKEYS GET: expected slot to be a finite number, got (.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/client/lib/commands/HOTKEYS_GET.ts","lineNumber":50,"sourceCode":"  allCommandsAllSlotsUs: number;\n  /** Only present when sample-ratio > 1 AND selected-slots is not empty */\n  netBytesSampledCommandsSelectedSlots?: number;\n  /** Only present when selected-slots is not empty */\n  netBytesAllCommandsSelectedSlots?: number;\n  netBytesAllCommandsAllSlots: number;\n  collectionStartTimeUnixMs: number;\n  collectionDurationMs: number;\n  totalCpuTimeSysMs: number;\n  totalCpuTimeUserMs: number;\n  totalNetBytes: number;\n  byCpuTimeUs?: Array<HotkeyEntry>;\n  byNetBytes?: Array<HotkeyEntry>;\n}\n\nfunction toSlotNumber(value: unknown): number {\n  const slot = Number(value);\n  if (!Number.isFinite(slot)) {\n    throw new TypeError(\n      `HOTKEYS GET: expected slot to be a finite number, got ${JSON.stringify(value)}`\n    );\n  }\n  return slot;\n}\n\n/**\n * Parse the hotkeys array into HotkeyEntry objects\n */\nfunction parseHotkeysList(arr: unknown): Array<HotkeyEntry> {\n  return mapLikeEntries(arr).map(([key, value]) => ({\n    key,\n    value: Number(value)\n  }));\n}\n\n/**\n * Parse slot ranges from the server response.","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/redis/node-redis/blob/bb5beb56578573910e2ee8f39681edc214c41398/packages/client/lib/commands/HOTKEYS_GET.ts#L32-L68","documentation":"Thrown by toSlotNumber while transforming a HOTKEYS GET reply, when an element that must be a Redis slot number (selected-slots ranges) cannot be coerced to a finite number via Number(). This is a reply-shape mismatch: the server returned something other than an integer where the client expects slot ordinals (0-16383).","triggerScenarios":"Returned from client.hotkeys.get() when the server's HOTKEYS GET reply's selected-slots field contains a non-numeric value (string, null, NaN, undefined, nested object). Can indicate a server-side version that emits a different reply schema than the client's transformHotkeysGetReply expects.","commonSituations":"Redis server / module version mismatch where the HOTKEYS subcommand reply format changed; a proxy or RESP transformation layer mangling numeric fields into strings; pointing the client at a server build that does not implement HOTKEYS the way the client assumes.","solutions":["Verify the Redis server version/build supports HOTKEYS GET in the reply shape the client expects.","Upgrade @redis/client to a version matching your server's HOTKEYS implementation.","If interoperating with a different schema, call sendCommand('HOTKEYS','GET') and parse the raw reply yourself instead of using the typed transform.","Report the unexpected reply shape to node-redis with the server version and raw reply."],"exampleFix":"// before: typed transform throws on a schema mismatch\nconst data = await client.hotkeys.get();\n\n// after: bypass the transform and inspect the raw reply to diagnose\nconst raw = await client.sendCommand(['HOTKEYS', 'GET']);\nconsole.log(raw);","handlingStrategy":"try-catch","validationCode":"// Server reply contents cannot be validated before the call. Diagnose via raw:\n// const raw = await client.sendCommand(['HOTKEYS','GET']);","typeGuard":"function isFiniteSlot(v) { return Number.isFinite(Number(v)); }","tryCatchPattern":"try { return await client.hotkeys.get(); } catch (e) { if (/expected slot to be a finite number/.test(e.message)) { const raw = await client.sendCommand(['HOTKEYS','GET']); /* parse raw yourself */ } else throw e; }","preventionTips":["Match @redis/client version to the Redis server build that implements HOTKEYS.","Use sendCommand for an untyped reply when server schema is in flux.","Report schema mismatches with server version info."],"tags":["hotkeys","reply-transform","version-mismatch","server-compat"],"analyzedSha":"bb5beb56578573910e2ee8f39681edc214c41398","analyzedAt":"2026-08-03T19:09:15.686Z","schemaVersion":2}