JedisException: Could not get a resource from the pool Redis Origin: Data OSI layer 7 · Application Last updated 5 Nov 2026

Jedis: redis.clients.jedis.exceptions.JedisException: Could not get a resource from the pool

The Jedis connection pool had no available connection within the wait time, or couldn't create one.

Exact message you may see redis.clients.jedis.exceptions.JedisException: Could not get a resource from the poolCould not get a resource from the poolJedisConnectionException: Could not get a resource from the poolredis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refusedCannot get Jedis connection
Seen on: Redis Java

Meaning

Check the root cause (nested exception): Redis unreachable, pool exhausted (maxTotal), or connections leaked (not closed). Use try-with-resources (try (Jedis j = pool.getResource())), increase maxTotal/maxWaitMillis, and verify Redis connectivity/auth.

Common causes

  • Pool exhausted (maxTotal too small)
  • Connections not returned (missing close)
  • Redis down/unreachable (nested JedisConnectionException)
  • Wrong host/password
  • Long blocking commands holding connections

⚡ Quick fix

  1. Use try-with-resources for every getResource()
  2. Tune JedisPoolConfig.setMaxTotal(128) and setMaxWait(Duration.ofSeconds(2))
  3. Check the nested cause and Redis reachability

Detailed fix by platform

Java

  1. try (Jedis jedis = pool.getResource()) { jedis.set("k","v"); }

How to diagnose

  1. Cause — Nested exception?
  2. Close — try-with-resources?
  3. Pool — maxTotal?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Data. Errors that are often confused with or caused by this one (click to open):

BullMQ: Missing lock for job / job stalled more than allowable limit — BullMQ: Error: Missing lock for job 42. moveToFinished / job stalled more than allowable limit (Redis)BullMQ: Missing lock …BUSY Redis is busy running a script — Redis: (error) BUSY Redis is busy running a script. You can only call SCRIPT KILL or SHUTDOWN NOSAVE (Redis)BUSY Redis is busy ru…Celery with Redis: tasks run twice (visibility_timeout) — Celery: Task executed twice / Restoring unacked messages — Redis broker visibility_timeout shorter than task ETA (Redis)Celery with Redis: ta…Client output buffer limit reached (scheduled to be closed) — Redis: Client id=12 addr=10.0.0.5:51234 scheduled to be closed ASAP for overcoming of output buffer limits (Redis)Client output buffer …ERR max number of clients reached — Redis: ERR max number of clients reached (Redis)ERR max number of cli…Error: connect ECONNREFUSED 127.0.0.1:6379 — Redis: Error: connect ECONNREFUSED 127.0.0.1:6379 / Could not connect to Redis at 127.0.0.1:6379: Connection refused (Redis)Error: connect ECONNR…Redis::CannotConnectError (Sidekiq/Rails) — Redis::CannotConnectError: Error connecting to Redis on localhost:6379 (Errno::ECONNREFUSED) (Ruby / Rails)Redis::CannotConnectE…redis.exceptions.ConnectionError: Too many connections — redis-py: redis.exceptions.ConnectionError: Too many connections (Redis)redis.exceptions.Conn…JedisExce…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.