Redis: (error) ERR DB index is out of range / ERR SELECT is not allowed in cluster mode
SELECT n used a database number the server doesn't have, or you're on Redis Cluster/managed Redis that only has DB 0.
ERR DB index is out of range(error) ERR DB index is out of rangeERR SELECT is not allowed in cluster modeReplyError: ERR DB index is out of rangeredis.exceptions.ResponseError: DB index is out of range Meaning
Default is 16 databases (databases 16); increase in redis.conf if needed. Redis Cluster supports only DB 0 and rejects SELECT. Some managed services limit DBs. Many frameworks default to DB 1+ in URLs (redis://host/5): use DB 0 or namespaced keys instead.
Common causes
- DB number ≥
databasessetting - Redis Cluster or provider with a single database
redis://host/5URL pointing to a non-existent DB- Config change after restart
- Proxy (Envoy, Twemproxy) limiting SELECT
⚡ Quick fix
- Use DB 0 and key prefixes for separation
- Raise
databasesin redis.conf - Remove the
/Nsuffix from the URL for Cluster/managed services
Detailed fix by platform
Linux
redis-cli CONFIG GET databases; redis-cli -n 3 ping
How to diagnose
- DB number — Within range?
- Mode — Cluster?
- URL — Suffix?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Can't connect to Redis from another host (bind 127.0.0.1) Redis: Could not connect to Redis at 10.0.0.5:6379: Connection timed out
- ERR CONFIG SET failed (possibly related to argument) Redis: (error) ERR CONFIG SET failed (possibly related to argument 'maxmemory') - can't set immutable config
- ERR This instance has cluster support disabled Redis: (error) ERR This instance has cluster support disabled
Most viewed in Redis
- READONLY You can't write against a read only replica Redis: READONLY You can't write against a read only replica
- MISCONF Redis: MISCONF Redis is configured to save RDB snapshots, but it's currently unable to persist to disk
- OOM command not allowed Redis: OOM command not allowed when used memory > 'maxmemory'
Other ways to find it
Where this error sits
Origin: Data. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Report a correction or suggest an improvement
Last updated 5 Nov 2026