EXECABORT: Transaction discarded after an error
A command queued during MULTI failed the queue-time check, so EXEC refuses to run any of them and throws the whole transaction away.
- Error prefix
EXECABORT- Категория
- Data types and commands
Что это значит
MULTI starts a queue: commands after it are not run, only checked and stacked. If one of them fails the queue-time check, an unknown command or a wrong argument count, Redis remembers the failure, and when EXEC arrives it refuses the entire transaction with EXECABORT instead of running the good commands. Nothing from the queue executes; the client starts over.
Note the split in error timing. Commands that fail at queue time abort the transaction. Commands that fail at run time, such as WRONGTYPE against a key, do not: EXEC still runs the others, and the failed one returns its own error inside the results. The bare reply "EXECABORT Transaction discarded because of previous errors." only means the first kind. A second form, "EXECABORT Transaction discarded because of: <error>", means Redis refused EXEC itself, for example "BUSY Redis is busy running a script" or OOM.
Распространённые причины
- A queued command had the wrong argument count and failed the arity check when queued.
- A queued command name was misspelled or does not exist on this server.
- A client library building a transaction from user input passed an empty or malformed entry.
Find the cause
MONITOR # Watch the connection live: MONITOR lists only commands that run, so queued commands show up only if EXEC runs them. Queue-time errors and EXECABORT are replies, so MONITOR never shows them. # Caution: every command on the server is mirrored to this client, so stop it once you have the answer.
Как исправить
-
Read the error the server reported during MULTI; it names the command that poisoned the queue:
MULTI SET msg hello GET # (error) ERR wrong number of arguments for 'get' command EXEC # (error) EXECABORT Transaction discarded because of previous errors.
-
Discard explicitly when your code detects a bad queue, instead of waiting for EXEC:
DISCARD
-
Re-run the transaction once the failing command is fixed; Redis never returns partial results from an aborted one.
Other ways to handle it
Lua scripts via EVAL run atomically, but Redis does not roll them back: a runtime error keeps the writes made before it. For check-then-write flows, WATCH plus MULTI aborts EXEC if a watched key changes; it does not stop a run-time error from applying the other commands.
Безопасное воспроизведение
redis-cli MULTI SET msg hello GET # Queued, but arity-checked: this one is bad EXEC # (error) EXECABORT Transaction discarded because of previous errors. GET msg # (nil) - the SET never ran
Вопросы
Did any of my commands run?
No. EXECABORT means the whole queue was discarded. That differs from a run-time error inside EXEC, where the other commands do run.
Why fail the whole transaction for one bad command?
Queue-time failures are statically checkable: the client sent something structurally wrong. Running the rest would hide the broken call and make the outcome depend on which commands happened to be valid.
Связанные ошибки
ERR wrong number of argumentsArgument count is wrongERR unknown commandRedis does not know this command25P02PostgreSQL: текущая транзакция прервана
More data types and commands errors
WRONGTYPEThe key holds a different data typeNOSCRIPTScript SHA1 is not cachedBUSYServer is blocked by a long scriptERR invalid expire timeExpire value is out of range
Код и текст сообщения взяты из Redis documentation and source code. Смотрите весь Redis error list или поиск по всем ошибкам баз данных.
Work on Redis in SQLly
A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for Redis and the other databases you use.
Текст и данные на этой странице: CC BY 4.0, с указанием SQLly (sqlly.app). Код и фрагменты SQL: MIT. Подробнее о лицензии Цитируемый текст сообщений об ошибках принадлежит производителю СУБД.