redis/node-redis · error · Error

All replies must be array of numbers for logical OR…

Error message

All replies must be array of numbers for logical OR aggregation

What it means

Thrown by the agg_logical_or response reducer when at least one shard's reply is not an array of numbers. This is the OR counterpart to the logical AND reducer. No command in the current static metadata snapshot uses agg_logical_or, so encountering this error means a future metadata regeneration or a dynamic COMMAND DOCS response tagged a command with this policy whose reply shape is incompatible.

Solutions

  1. Identify which command triggered the error and verify its reply shape matches what agg_logical_or expects (array of numbers per shard)
  2. If the command's reply shape is incompatible, report it as a metadata mismatch
  3. Fall back to issuing the command to a single node via sendCommand if cluster-wide aggregation is not needed
Defensive patterns

Strategy: try-catch

Type guard

function isLogicalOrAggError(err: unknown): boolean {
  return err instanceof Error && err.message.includes('logical OR aggregation');
}

Try / catch

try {
  // the command that triggered agg_logical_or
  await cluster.sendCommand(RO, 'COMMAND_NAME', ['arg']);
} catch (err) {
  if (err instanceof Error && err.message.includes('logical OR aggregation')) {
    // no standard command currently uses this — report as metadata issue
  } else {
    throw err;
  }
}

Prevention

When it happens

Trigger: A command dynamically discovered via COMMAND DOCS tagged with agg_logical_or whose shard replies are not arrays of numbers; a metadata regeneration that adds this policy to a command with an unexpected reply shape.

Common situations: New Redis version introduces a command tagged agg_logical_or; custom metadata override that assigns this policy incorrectly.

Related errors


AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11). Data as JSON: /api/errors/ba709ebe8265a39d. Report an issue: GitHub.

Appendix: 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 90fd0652bc)