1. Explore
  2. »
  3. Jedis

Jedis errors

Jedis is a blazingly small and sane Redis java client

https://github.com/xetorthio/jedis
Solution coverage:
Summary coverage:

Top patterns

  1. Redis responded with an error code that is not processed by Jedis

    This exception can occur in different situations. For example.: Missing authentication parameter, etc.

  2. Read responded with an error code that is not handled by Jedis
    No solution
  3. End of stream while reading Redis response

    There are multiple things to check when you have Jedis connection issues. A handful of tips are discussed in this GitHub issue:

    • call close() to return the Jedis instance to the pool (do not call returnResource())
    • catch JedisConnectionException for each Jedis command, and retrieve a new Jedis instance from the pool for the next Jedis commands to work (in the catch clause)
    • Change the timeout (in JedisPool constructor), because in my case, I retrieve a new Jedis instance at the beginning of the request and I return it at the end of the request. Because a request may last more than 2 seconds (not optimized code yet), the timeout needed to be greater
    • Change the pool max clients, but it must be lower than the redis maxclients in redis configuration
    • Change the pool max idle clients
    • Set testOnBorrow, testOnReturn and testWhildIdle to true for the JedisPool so that the connection to redis is validated often enough to avoid connection issues (all of these test methods may not be necessary but I used all of them and it works)
Error patternsPackagesClassesMethodsExceptions
DescriptionException TypeEntry MethodWeb pages

Redis responded with an error code that is not processed by Jedis

redis.clients.jedis.exceptions.JedisDataException
redis.clients.jedis.Protocol.processError
103Web pages
1Solution
JedisDataExceptionProtocol.processError()103

Read responded with an error code that is not handled by Jedis

redis.clients.jedis.exceptions.JedisDataException
2 frames hidden
redis.clients.jedis.Protocol.read
102Web pages
JedisDataExceptionProtocol.read()102

End of stream while reading Redis response

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.util.RedisInputStream.ensureFill
36Web pages
1Solution
JedisConnectionExceptionRedisInputStream.ensureFill()36

Unable to connect Redis

java.net.ConnectException
6 frames hidden
redis.clients.jedis.Connection.connect
31Web pages
ConnectExceptionConnection.connect()31

Redis connection cannot be opened on a dual (IPV4/IPV6) socket

java.net.ConnectException
8 frames hidden
redis.clients.jedis.Connection.connect
24Web pages
ConnectExceptionConnection.connect()24

Redis connection timed out

java.net.SocketTimeoutException
8 frames hidden
redis.clients.jedis.Connection.connect
22Web pages
SocketTimeoutExceptionConnection.connect()22

Jedis cannot get a connection from the pool

java.net.ConnectException
10 frames hidden
redis.clients.jedis.BinaryClient.connect
22Web pages
JedisConnectionExceptionBinaryClient.connect()22

Redis responded an error code that is unhandled by Jedis

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.jedis.Protocol.process
21Web pages
1Solution
JedisConnectionExceptionProtocol.process()21

Binary Jedis connection timed out

java.net.SocketTimeoutException
10 frames hidden
redis.clients.jedis.BinaryClient.connect
20Web pages
JedisConnectionExceptionBinaryClient.connect()20

Jedis got an unhandled error code from Redis

redis.clients.jedis.exceptions.JedisConnectionException
1 frames hidden
redis.clients.jedis.Protocol.read
19Web pages
JedisConnectionExceptionProtocol.read()19

Redis connection cannot be opened

java.net.ConnectException
8 frames hidden
redis.clients.jedis.BinaryClient.connect
19Web pages
JedisConnectionExceptionBinaryClient.connect()19

BinaryJedis.connect() has thrown a JedisConnectionException

java.net.ConnectException
11 frames hidden
redis.clients.jedis.BinaryJedis.connect
19Web pages
JedisConnectionExceptionBinaryJedis.connect()19

Jedis cannot access Redis.

java.net.SocketException
3 frames hidden
redis.clients.util.RedisOutputStream.flushBuffer
17Web pages
SocketExceptionRedisOutputStream.flushBuffer()17

Jedis cannot access Redis.

java.net.SocketTimeoutException
5 frames hidden
redis.clients.util.RedisInputStream.ensureFill
15Web pages
SocketTimeoutExceptionRedisInputStream.ensureFill()15

Redis aborted the connection

java.net.SocketException
4 frames hidden
redis.clients.util.RedisOutputStream.flush
15Web pages
SocketExceptionRedisOutputStream.flush()15

Tried to use the same Jedis object in multiple Threads

java.lang.ClassCastException
redis.clients.jedis.Connection.getIntegerReply
14Web pages
1Solution
ClassCastExceptionConnection.getIntegerReply()14

Redis closed the connection and Jedis got an empty response

redis.clients.jedis.exceptions.JedisConnectionException
redis.clients.util.RedisInputStream.readLine
14Web pages
JedisConnectionExceptionRedisInputStream.readLine()14

Jedis client uses an invalid connection

java.lang.ClassCastException
redis.clients.jedis.Connection.getBinaryMultiBulkReply
13Web pages
1Solution
ClassCastExceptionConnection.getBinaryMultiBulkReply()13

JedisFactory.makeObject() has thrown a JedisConnectionException

java.net.ConnectException
12 frames hidden
redis.clients.jedis.JedisFactory.makeObject
13Web pages
JedisConnectionExceptionJedisFactory.makeObject()13

Timeout while getting a Redis connection from the pool.

java.util.NoSuchElementException
2 frames hidden
redis.clients.util.Pool.getResource
12Web pages
NoSuchElementExceptionPool.getResource()12

BinaryJedis.connect() has thrown a JedisConnectionException

java.net.ConnectException
9 frames hidden
redis.clients.jedis.BinaryJedis.connect
12Web pages
JedisConnectionExceptionBinaryJedis.connect()12

Cannot read Redis status code reply as a byte array

java.lang.ClassCastException
redis.clients.jedis.Connection.getStatusCodeReply
12Web pages
ClassCastExceptionConnection.getStatusCodeReply()12

Jedis cannot access Redis.

java.net.SocketTimeoutException
6 frames hidden
redis.clients.util.RedisInputStream.ensureFill
12Web pages
JedisConnectionExceptionRedisInputStream.ensureFill()12

BinaryJedis.connect() has thrown a JedisConnectionException

java.net.SocketTimeoutException
11 frames hidden
redis.clients.jedis.BinaryJedis.connect
10Web pages
JedisConnectionExceptionBinaryJedis.connect()10

Redis connection timed out on a dual (IPV4/IPV6) socket

java.net.SocketTimeoutException
11 frames hidden
redis.clients.jedis.BinaryJedis.connect
10Web pages
JedisConnectionExceptionBinaryJedis.connect()10

runWithRetries method's attempt variable is less than 1

redis.clients.jedis.exceptions.JedisClusterMaxRedirectionsException
6 frames hidden
redis.clients.jedis.JedisClusterCommand.run
9Web pages
1Solution
JedisClusterMaxRedirectionsExceptionJedisClusterCommand.run()9

This error occurs when the build method cannot cast the result to byte[].

java.lang.ClassCastException
1 frames hidden
redis.clients.jedis.BuilderFactory$5.build
8Web pages
ClassCastExceptionBuilderFactory$5.build()8

Cannot read response from Redis

java.net.SocketTimeoutException
1 frames hidden
redis.clients.jedis.Protocol.read
8Web pages
SocketTimeoutExceptionProtocol.read()8

Jedis write buffer overloaded.

java.lang.ArrayIndexOutOfBoundsException
1 frames hidden
redis.clients.jedis.Protocol.sendCommand
8Web pages
1Solution
ArrayIndexOutOfBoundsExceptionProtocol.sendCommand()8

Redis read timed out

java.net.SocketTimeoutException
6 frames hidden
redis.clients.jedis.Protocol.process
8Web pages
SocketTimeoutExceptionProtocol.process()8

Pool.getResource() has thrown a JedisConnectionException

java.net.ConnectException
15 frames hidden
redis.clients.util.Pool.getResource
7Web pages
JedisConnectionExceptionPool.getResource()7

Connection.sendCommand() has thrown an ArrayIndexOutOfBoundsException

java.lang.ArrayIndexOutOfBoundsException
3 frames hidden
redis.clients.jedis.Connection.sendCommand
7Web pages
ArrayIndexOutOfBoundsExceptionConnection.sendCommand()7

BinaryClient.connect() has thrown a JedisConnectionException

java.net.ConnectException
8 frames hidden
redis.clients.jedis.BinaryClient.connect
7Web pages
JedisConnectionExceptionBinaryClient.connect()7

JedisPool.getResource() has thrown a JedisConnectionException

java.net.SocketTimeoutException
18 frames hidden
redis.clients.jedis.JedisPool.getResource
7Web pages
JedisConnectionExceptionJedisPool.getResource()7

RedisInputStream.ensureFill() has thrown a JedisConnectionException

java.net.SocketException
4 frames hidden
redis.clients.util.RedisInputStream.ensureFill
7Web pages
JedisConnectionExceptionRedisInputStream.ensureFill()7

Jedis client is not available in the pool anymore

java.lang.IllegalStateException
2 frames hidden
redis.clients.util.Pool.returnResourceObject
7Web pages
1Solution
JedisExceptionPool.returnResourceObject()7

Jedis cannot connect to Redis on a socket

java.net.ConnectException
9 frames hidden
redis.clients.jedis.BinaryJedis.connect
7Web pages
JedisConnectionExceptionBinaryJedis.connect()7

Jedis tried to return an invalidated connection

java.lang.IllegalStateException
1 frames hidden
redis.clients.util.Pool.returnBrokenResourceObject
6Web pages
IllegalStateExceptionPool.returnBrokenResourceObject()6

Timeout while reading Redis response

java.net.SocketTimeoutException
4 frames hidden
redis.clients.util.RedisInputStream.ensureFill
6Web pages
1Solution
SocketTimeoutExceptionRedisInputStream.ensureFill()6

Connection.connect() has thrown a SocketTimeoutException

java.net.SocketTimeoutException
6 frames hidden
redis.clients.jedis.Connection.connect
6Web pages
SocketTimeoutExceptionConnection.connect()6

Connection.readProtocolWithCheckingBroken() has thrown a JedisConnectionException

java.net.SocketTimeoutException
10 frames hidden
redis.clients.jedis.Connection.readProtocolWithCheckingBroken
6Web pages
JedisConnectionExceptionConnection.readProtocolWithCheckingBroken()6

RedisInputStream.readByte() has thrown a JedisConnectionException

java.net.SocketTimeoutException
7 frames hidden
redis.clients.util.RedisInputStream.readByte
6Web pages
JedisConnectionExceptionRedisInputStream.readByte()6

The hash moved to a different Redis node

redis.clients.jedis.exceptions.JedisMovedDataException
2 frames hidden
redis.clients.jedis.Protocol.read
6Web pages
1Solution
JedisMovedDataExceptionProtocol.read()6

Connection.sendCommand() has thrown a SocketTimeoutException

java.net.SocketTimeoutException
2 frames hidden
redis.clients.jedis.Connection.sendCommand
6Web pages
SocketTimeoutExceptionConnection.sendCommand()6

JedisPool.getResource() has thrown a JedisConnectionException

java.net.ConnectException
16 frames hidden
redis.clients.jedis.JedisPool.getResource
6Web pages
JedisConnectionExceptionJedisPool.getResource()6

Jedis cannot connect to Redis.

java.net.ConnectException
6 frames hidden
redis.clients.jedis.Connection.connect
6Web pages
ConnectExceptionConnection.connect()6

Jedis pool cannot give Jedis client.

java.net.ConnectException
14 frames hidden
redis.clients.util.Pool.getResource
6Web pages
JedisConnectionExceptionPool.getResource()6

Connection.readProtocolWithCheckingBroken() has thrown a JedisMovedDataException

redis.clients.jedis.exceptions.JedisMovedDataException
3 frames hidden
redis.clients.jedis.Connection.readProtocolWithCheckingBroken
5Web pages
JedisMovedDataExceptionConnection.readProtocolWithCheckingBroken()5

Connection.sendCommand() has thrown a JedisConnectionException

java.net.ConnectException
9 frames hidden
redis.clients.jedis.Connection.sendCommand
5Web pages
JedisConnectionExceptionConnection.sendCommand()5

Response.get() has thrown a ClassCastException

java.lang.ClassCastException
3 frames hidden
redis.clients.jedis.Response.get
5Web pages
ClassCastExceptionResponse.get()5
Nothing to list here.
Nothing to list here.
Nothing to list here.
Nothing to list here.