EXECABORT error
A transaction was discarded because one of its commands had an error.
Redis returns this error from EXEC when a command in the transaction couldn't be queued. Redis then discards the whole transaction, so none of its commands run.
EXECABORT Transaction discarded because of previous errors.
In client libraries
| Client library | Exception or error type | Message |
|---|---|---|
| redis-py | ResponseError |
Command # <n> (<command>) of pipeline caused error: <error>redis-py raises the error of the command that failed to queue, not EXECABORT. |
| Jedis | JedisDataException |
EXECABORT Transaction discarded because of previous errors.The errors of the commands that failed to queue are attached to the exception as suppressed exceptions. |
| node-redis | SimpleError |
ERR unknown command '<command>'exec() rejects with the error of the command that failed to queue, not EXECABORT. |
| Lettuce The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()). |
RedisCommandExecutionException |
EXECABORT Transaction discarded because of previous errors. |
| go-redis | redis.ErrorTest with redis.IsExecAbortError(err) |
EXECABORT Transaction discarded because of previous errors. |
| ioredis | ReplyErrorTest with err.message.startsWith('EXECABORT') |
EXECABORT Transaction discarded because of previous errors. |
| StackExchange.Redis NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions. |
RedisServerException |
EXECABORT Transaction discarded because of previous errors. |
| Predis | Predis\Transaction\AbortedMultiExecException |
ERR unknown command '<command>'transaction() throws with the error of the command that failed to queue, not EXECABORT. |
| redis-rb | Redis::CommandError |
ERR unknown command '<command>' (redis://<host>:<port>)multi raises the error of the command that failed to queue, not EXECABORT. |
| redis-rs The sync and async APIs raise the same errors. |
ErrorKind::Server(ServerErrorKind::ExecAbort) |
Transaction aborted: [(Index <n>, error: <error>)] |
Example
Between MULTI and EXEC, Redis queues each command to run later. A command with an error, such as an unknown command name, is rejected instead of queued. EXEC then refuses to run the transaction:
> MULTI
OK
> FOO
(error) ERR unknown command 'FOO'
> SET a 1
QUEUED
> EXEC
(error) EXECABORT Transaction discarded because of previous errors.
How to fix it
Look at the reply to each command in the transaction. The command that failed got an error instead of QUEUED, and that error tells you what to fix. Common ones are ERR unknown command and ERR wrong number of arguments.
If Redis refuses the EXEC command itself, the message gives the reason after a colon. For example, when the user isn't allowed to run EXEC:
EXECABORT Transaction discarded because of: NOPERM User <username> has no permissions to run the 'exec' command
Errors that happen while EXEC runs the commands don't discard the transaction. For example, a WRONGTYPE error makes only that command fail. The other commands still run, and EXEC returns the error in its list of replies. See Errors inside a transaction.