redis/node-redis · error · MultiErrorReply
commands failed, see .replies and .errorIndexes for more…
Error message
${errorIndexes.length} commands failed, see .replies and .errorIndexes for more information What it means
After executing a MULTI/EXEC transaction, one or more queued commands returned an ErrorReply from the server. The client collects all per-command errors and throws a MultiErrorReply containing the full replies array and the indexes of failed commands for inspection.
Solutions
- Catch MultiErrorReply and iterate .errorIndexes to find which commands failed
- Inspect .replies[i] for the specific ErrorReply message of each failed command
- Use the .errors() generator to iterate only the error replies
- Validate key types and command preconditions before queuing commands in the transaction
Example fix
// before
const replies = await multi.exec();
// after
try {
const replies = await multi.exec();
} catch (e) {
if (e instanceof MultiErrorReply) {
for (const [idx, err] of e.errors()) {
console.error(`Command ${idx} failed:`, err.message);
}
} else {
throw e;
}
} Defensive patterns
Strategy: try-catch
Type guard
import { MultiErrorReply } from 'redis';
function isMultiErrorReply(e: unknown): e is MultiErrorReply {
return e instanceof MultiErrorReply;
} Try / catch
try {
const replies = await multi.exec();
} catch (e) {
if (e instanceof MultiErrorReply) {
for (const err of e.errors()) {
console.error('Transaction command failed:', err.message);
}
// Optionally inspect e.replies for successful command results
} else {
throw e;
}
} Prevention
- Validate key types and command preconditions before queuing commands in MULTI
- Use WATCH for optimistic locking to detect conflicts before EXEC
- Inspect MultiErrorReply.errorIndexes to identify which specific commands failed
- Test transactions with realistic data to catch type-mismatch errors early
When it happens
Trigger: A transaction where individual commands fail at EXEC time — WRONGTYPE on a key, arity errors, or server-side constraint violations. The transaction executes atomically but some commands within it error.
Common situations: Transaction contains a command operating on a key with the wrong data type; server OOM during execution; a queued command with invalid arguments that passes QUEUED but fails at EXEC; permission errors on specific commands.
Related errors
- HIMPORT PREPARE/DISCARD/DISCARDALL are not supported inside…
- Client reconnected after WATCH
- HTTP
- HTTP
- One (or more) of the watched keys has been changed
AI-assisted analysis of redis/node-redis@90fd0652bc (2026-08-11).
Data as JSON: /api/errors/cd9e30c81091ebe2.
Report an issue: GitHub.
Appendix: source
Thrown at packages/client/lib/multi-command.ts:74
redisArgs.push(...args);
this.addCommand(redisArgs, transformReply);
}
transformReplies(rawReplies: Array<unknown>): Array<unknown> {
const errorIndexes: Array<number> = [],
replies = rawReplies.map((reply, i) => {
if (reply instanceof ErrorReply) {
errorIndexes.push(i);
return reply;
}
const { transformReply, args } = this.queue[i];
return transformReply ? transformReply(reply, args.preserve, this.typeMapping) : reply;
});
if (errorIndexes.length) throw new MultiErrorReply(replies, errorIndexes);
return replies;
}
}
View on GitHub (pinned to 90fd0652bc)