ERR
RedisERRORCommonTransactionsHIGH confidence

EXEC without MULTI

Production Risk

Low. This is a simple protocol violation that is easily caught and fixed.

What this means

This error occurs when a client sends an EXEC command but is not currently in a transaction state. A transaction must first be initiated with the MULTI command.

Why it happens
  1. 1A client library bug where EXEC is called improperly.
  2. 2A client connection was dropped and reconnected, losing the transaction context, but the application logic tried to EXEC anyway.
  3. 3Manual execution of EXEC in a CLI session without first typing MULTI.
How to reproduce

A client sends an EXEC command on a fresh connection.

trigger — this will error
trigger — this will error
EXEC

expected output

(error) ERR EXEC without MULTI

Fix 1

Wrap the transaction in a MULTI/EXEC block

WHEN Always, when using transactions

Wrap the transaction in a MULTI/EXEC block
MULTI
INCR mycounter
EXEC

Why this works

The MULTI command initiates a transaction block. All subsequent commands are queued until EXEC is called, which executes them atomically.

Fix 2

Use a client library's transaction abstraction

WHEN In application code

Use a client library's transaction abstraction
// node-redis example
await client.multi().incr('mycounter').exec();

Why this works

High-level client libraries provide abstractions that ensure MULTI, the queued commands, and EXEC are called in the correct order, preventing this error.

What not to do

Send EXEC and hope for the best

It will always fail if not preceded by MULTI in the same session. The protocol is stateful and strict.

Sources
Official documentation ↗

Transaction state machine in connection handling.

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All Redis errors