You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Invalid db option causes ReplyError: ERR invalid DB index #1213
Pass db option as a string when creating Redis object:
const Redis = require("ioredis");
const redis = new Redis({db: 'some-string'})
It will throw an uncaught error:
(node:2467) UnhandledPromiseRejectionWarning: ReplyError: ERR invalid DB index
at parseError (node_modules/redis-parser/lib/parser.js:179:12)
at parseType (node_modules/redis-parser/lib/parser.js:302:14)
(node:2467) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:2467) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
What causes this
All select commands have no callback or error handling in ioredis.
What I expect
This error is caught by ioredis either through a rejected promise fromRedis.connect() or the error event listener but not an unhandledPromiseRejection.
Closing as fixed. An invalid db no longer crashes the process: the failed SELECT is emitted as an error event, and the client stays on db 0. If you still see a crash on v6, please open a new issue with a reproduction.
Activity
PavelPashov commentedon Oct 29, 2026
Closing as fixed. An invalid
dbno longer crashes the process: the failedSELECTis emitted as anerrorevent, and the client stays on db 0. If you still see a crash on v6, please open a new issue with a reproduction.