# Redis: (error) ERR DB index is out of range / ERR SELECT is not allowed in cluster mode

**Code:** `ERR DB index is out of range` · **Category:** Redis · **Seen on:** Redis, Node.js

`SELECT n` used a database number the server doesn't have, or you're on Redis Cluster/managed Redis that only has DB 0.

## 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 ≥ `databases` setting
- Redis Cluster or provider with a single database
- `redis://host/5` URL pointing to a non-existent DB
- Config change after restart
- Proxy (Envoy, Twemproxy) limiting SELECT

## Quick fix

1. Use DB 0 and key prefixes for separation
2. Raise `databases` in redis.conf
3. Remove the `/N` suffix from the URL for Cluster/managed services

## Detailed fix by platform

### Linux

1. `redis-cli CONFIG GET databases; redis-cli -n 3 ping`

## How to diagnose

1. **DB number** — Within range?
2. **Mode** — Cluster?
3. **URL** — Suffix?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/redis/redis-db-index-out-of-range)
