{"record":{"id":"91b1d01fdbc49c1c","repo":"redis/node-redis","slug":"default-keyed-reducer-split-reply-missing-positio","errorCode":null,"errorMessage":"default-keyed reducer: split reply missing position hints","messagePattern":"default-keyed reducer: split reply missing position hints","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/client/lib/cluster/request-response-policies/dispatch.ts","lineNumber":273,"sourceCode":"  _parser: CommandParser,\n  positionHints?: Array<Array<number> | undefined>\n): Promise<T> => {\n  const responses = await Promise.all(promises);\n\n  // Unsplit (single-target read, or a multi_shard command that landed on one\n  // slot): pass the sole reply through unchanged.\n  if (!positionHints?.some(hint => hint !== undefined)) {\n    return responses[0];\n  }\n\n  // Split multi_shard (e.g. MGET across slots): each sub-reply is an array in\n  // its own group order; scatter element i back to its original group ordinal\n  // so the result matches the caller's key order regardless of slot/arrival.\n  const result: Array<unknown> = [];\n  responses.forEach((reply, p) => {\n    const indices = positionHints[p];\n    if (!indices) {\n      throw new Error('default-keyed reducer: split reply missing position hints');\n    }\n    const elements = reply as Array<unknown>;\n    indices.forEach((groupIndex, i) => {\n      result[groupIndex] = elements[i];\n    });\n  });\n  return result as T;\n};\n\n/**\n * Response policies whose reducers compute over raw numbers (scalars or\n * number arrays). Per-node replies for these plans are decoded *without* the\n * caller's type mapping — a `NUMBER: String` mapping would otherwise feed\n * strings into the numeric aggregators and throw — and the caller's mapping\n * is applied to the aggregated result instead (`remapAggregateReply`).\n */\nexport const NUMERIC_AGG_POLICIES: ReadonlySet<ResponsePolicyWithDefaults> = new Set([\n  RESPONSE_POLICIES_WITH_DEFAULTS.AGG_SUM,","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/redis/node-redis/blob/90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58/packages/client/lib/cluster/request-response-policies/dispatch.ts#L255-L291","documentation":"Thrown by the default-keyed response reducer during multi-shard reply reassembly when a sub-reply at position p lacks its position hint (groupIndices). This is an internal invariant violation: the split path was entered because at least one hint was defined, but a specific entry's hint is undefined. It indicates a bug in how routeMultiShard or a downstream router constructed the plan, not a caller error.","triggerScenarios":"This error should not occur under normal usage of supported multi_shard commands (DEL, EXISTS, MGET, MSET, TOUCH, UNLINK). It fires only if a code path produces a plan where some entries carry groupIndices and others do not while the reducer's split-path guard was already passed — likely a custom router or a metadata override creating inconsistent plan entries.","commonSituations":"Internal library bug after a code change to the routing pipeline; custom command definition that bypasses the standard multi_shard router while still hitting the default-keyed reducer; a metadata override that changes a command's response policy without updating its request policy.","solutions":["Report this as a bug to the node-redis issue tracker with the exact command and arguments","If using custom command metadata overrides, verify the request and response policies are consistent","Avoid mixing multi_shard routing with non-multi_shard plan entries"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["This is an internal library invariant violation — report it with the command name, arguments, and stack trace","Avoid custom command metadata overrides that mix multi_shard routing with non-multi_shard response policies","If extending the routing pipeline, ensure every multi_shard plan entry carries groupIndices"],"tags":["cluster","internal-bug","multi-shard","reducer"],"backgroundTag":null,"analyzedSha":"90fd0652bc3f2a0a1b2f79fa9096b02a86b0ac58","analyzedAt":"2026-08-11T15:37:21.243Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}