redis/jedis · error · JedisException
${status}
Error message
${status} What it means
In a MULTI transaction, every queued command must reply +QUEUED. ReliableTransaction.appendCommand checks the status reply and throws JedisException(status) whenever the server returns something other than QUEUED — typically an error such as WRONGTYPE, unknown command, or OOM, reported at queue time rather than at exec() time.
Solutions
- Read the exception message — it is the raw server error (e.g. WRONGTYPE, NOPERM, OOM) — and fix the offending command's arguments/permissions.
- Verify the Redis server version supports every command queued in the transaction.
- Check the ACL rules for the authenticated user and memory limits before queuing.
- Call discard() on failure so the connection does not remain in MULTI state.
Example fix
// before
Transaction t = jedis.multi();
t.rpush("mystring", "v"); // throws JedisException: WRONGTYPE ...
// after
if (jedis.type("mystring").equals("list")) {
Transaction t = jedis.multi();
t.rpush("mystring", "v");
} else {
// handle wrong key type before opening the transaction
} Defensive patterns
Strategy: try-catch
Validate before calling
String type = jedis.type(key);
if (!expectedType.equals(type)) {
throw new IllegalStateException("Key " + key + " is " + type + ", expected " + expectedType);
} Try / catch
try {
transaction.set(key, value);
} catch (JedisException e) {
transaction.discard();
// e.getMessage() holds the server error: WRONGTYPE/NOPERM/OOM/unknown command
handleQueueError(e.getMessage());
} Prevention
- Check key types (TYPE) before queuing commands against them.
- Verify the ACL user has permission for every command queued.
- Confirm server version supports all commands used; watch maxmemory/OOM conditions.
When it happens
Trigger: Queuing a command inside MULTI whose arguments the server rejects: wrong key type (WRONGTYPE), command not loaded on the server (unknown command), out-of-memory (OOM), or NOPERM for missing ACL permissions.
Common situations: ACL-restricted users lacking rights to a queued command; Redis version older than the command used; OOM when maxmemory is hit; key type changed between planning and queuing.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Cannot use Jedis when in Multi. Please use Transaction or…
- It is not allowed to create Transaction from this
- MULTI command failed. Received response:
- EXEC without MULTI
- DISCARD without MULTI
AI-assisted analysis of redis/jedis@6dac31d4c2 (2026-09-08).
Data as JSON: /api/errors/245e68266ce4bec4.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/redis/clients/jedis/ReliableTransaction.java:128
String status = connection.executeCommand(commandObjects.watch(keys));
inWatch = true;
return status;
}
@Override
public String unwatch() {
connection.sendCommand(UNWATCH);
String status = connection.getStatusCodeReply();
inWatch = false;
return status;
}
@Override
protected final <T> Response<T> appendCommand(CommandObject<T> commandObject) {
connection.sendCommand(commandObject.getArguments());
String status = connection.getStatusCodeReply();
if (!QUEUED_STR.equals(status)) {
throw new JedisException(status);
}
Response<T> response = new Response<>(commandObject.getBuilder());
pipelinedResponses.add(response);
return response;
}
@Override
public final void close() {
try {
clear();
} finally {
if (closeConnection) {
connection.close();
}
}
}
@Deprecated // TODO: privateView on GitHub (pinned to 6dac31d4c2)