redis/node-redis · error · Error
All replies must be array of numbers for logical OR aggregat
Error message
All replies must be array of numbers for logical OR aggregation
What it means
Mirror of the logical-AND guard for the `agg_logical_or` response policy. Every shard reply must be an Array<number> before the column-wise OR fold runs. No command in the current metadata snapshot uses agg_logical_or, but the reducer is registered and must be correct for the first command tagged with it. The guard fails fast on shape mismatch rather than leaking operand values through the `||` fold.
Source
Thrown at packages/client/lib/cluster/request-response-policies/generic-aggregators.ts:54
/**
* Aggregates multiple arrays of numbers using logical OR operation.
* @remarks
* Mirror of `aggregateLogicalAnd` for the `agg_logical_or` response policy.
* No command in the current metadata snapshot uses it, but the reducer is
* registered in `RESPONSE_REDUCERS`, so it must be correct for the first
* command a future metadata regeneration tags with it.
*/
export const aggregateLogicalOr = <T>(replies: Array<unknown>): T => {
if (replies.length === 0) return [] as T;
if (
!replies.every(
(reply): reply is number[] =>
Array.isArray(reply) &&
reply.every((value): value is number => typeof value === 'number')
)
) {
throw new Error(
'All replies must be array of numbers for logical OR aggregation'
);
}
const result = Array(replies[0].length).fill(0);
for (const reply of replies) {
for (let i = 0; i < reply.length; i++) {
// clamp to 0/1: `||` returns the operand, so non-binary replies would
// otherwise leak through (e.g. 0 || 3 === 3).
result[i] = result[i] || reply[i] ? 1 : 0;
}
}
return result as T;
};
/**View on GitHub (pinned to bb5beb5657)
Solutions
- Verify the command's reply shape matches Array<number> across all nodes before tagging it agg_logical_or.
- Check command-metadata overrides for an incorrect response policy assignment.
- Inspect per-node replies directly to find the non-conforming node.
Defensive patterns
Strategy: try-catch
Type guard
function isNumberArray(reply: unknown): reply is number[] {
return Array.isArray(reply) && reply.every(v => typeof v === 'number');
} Try / catch
try {
await cluster.sendCommand(cmd, ...args);
} catch (e) {
if (/array of numbers for logical OR/.test(e.message)) {
// no current command uses agg_logical_or — check command-metadata overrides
} else throw e;
} Prevention
- Before tagging any command agg_logical_or, confirm its reply is Array<number> on every node.
- Audit command-metadata overrides for incorrect response-policy assignments.
- Test fan-out reply shapes against each master directly.
When it happens
Trigger: A command whose response policy is `agg_logical_or` where at least one shard reply is not an Array<number>. Currently no shipped command triggers this; it would fire only if a future metadata regeneration tags a command with agg_logical_or and a node returns a non-conforming shape.
Common situations: Future command metadata tagging a new command with agg_logical_or whose reply shape does not match; a custom/overridden response policy on a command returning non-numeric arrays.
Related errors
- All replies must be array of numbers for logical AND aggrega
- All replies must be number arrays of equal length for ${labe
- All replies must be numbers for min aggregation
- All replies must be numbers for max aggregation
- All replies must be numbers for sum aggregation
AI-assisted analysis of redis/node-redis@bb5beb5657 (2026-08-03).
Data as JSON: /data/errors/ba709ebe8265a39d.json.
Report an issue: GitHub.