{"record":{"id":"930b99ed7d571d38","repo":"qishibo/AnotherRedisDesktopManager","slug":"e-message-930b99","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/OperateItem.vue","lineNumber":246,"sourceCode":"      if (dbIndex !== false) {\n        this.selectedDbIndex = parseInt(dbIndex);\n      }\n\n      this.client.select(this.selectedDbIndex)\n        .then(() => {\n        // clear the search input\n          this.searchMatch = '';\n          this.$parent.$parent.$parent.$refs.keyList.refreshKeyList();\n          const dbKey = this.$storage.getStorageKeyByName('last_db', this.config.connectionName);\n          // store the last selected db\n          localStorage.setItem(dbKey, this.selectedDbIndex);\n          // tell cli to change db\n          this.client.options.db = this.selectedDbIndex;\n          this.$bus.$emit('changeDb', this.client, this.selectedDbIndex);\n        })\n      // select is not allowed in cluster mode\n        .catch((e) => {\n          this.$message.error({\n            message: e.message,\n            duration: 3000,\n          });\n\n          // reset to db0\n          this.selectedDbIndex = 0;\n        });\n    },\n    customDbName(db) {\n      const name = this.dbNames[db];\n\n      this.$prompt(this.$t('message.custom_name'), { inputValue: name }).then(({ value }) => {\n        this.$set(this.dbNames, db, value);\n        const dbKey = this.$storage.getStorageKeyByName('custom_db', this.config.connectionName);\n        localStorage.setItem(dbKey, JSON.stringify(this.dbNames));\n      }).catch(() => {});\n    },\n    filterDbCustomName(query) {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/OperateItem.vue#L228-L264","documentation":"Fires when this.client.select(selectedDbIndex) rejects inside changeDb(). The dominant cause is Redis Cluster: only DB 0 exists and cluster clients reject SELECT with 'SELECT is not allowed in cluster mode' (the code comment notes exactly this). Standalone causes include an index beyond the databases limit ('DB index is out of range'), NOAUTH, or a dropped connection; on any failure the component resets selectedDbIndex to 0.","triggerScenarios":"Picking a non-zero database in the DB dropdown while the connection is a cluster (client exposing nodes()); selecting an index >= the server's databases setting (default 16, indexes 0-15); executing SELECT on a socket that just dropped.","commonSituations":"Pointing the tool at ElastiCache/Azure cluster-mode endpoints while expecting standalone DB semantics; configs copied between standalone and cluster connections; small servers configured with databases < 16.","solutions":["Hide or disable the DB selector when the client is a cluster connection so SELECT is never issued","Verify the index is within the server's databases setting (redis-cli CONFIG GET databases)","Reconnect if the socket dropped, then retry the select","Keep the reset-to-db0 fallback so UI state matches server state after a failure"],"exampleFix":"// before\nthis.client.select(this.selectedDbIndex).then(() => { /* ... */ }).catch((e) => {\n  this.$message.error({ message: e.message, duration: 3000 });\n  this.selectedDbIndex = 0;\n});\n\n// after\nif (this.client.nodes) { // cluster client: only db 0 exists\n  this.$message.info(this.$t('message.cluster_only_db0'));\n  this.selectedDbIndex = 0;\n  return;\n}\nthis.client.select(this.selectedDbIndex).then(() => { /* ... */ }).catch((e) => {\n  this.$message.error({ message: e.message, duration: 3000 });\n  this.selectedDbIndex = 0;\n});","handlingStrategy":"validation","validationCode":"// cluster connections expose nodes(); SELECT only exists on standalone\nif (this.client.nodes) {\n  this.$message.info(this.$t('message.cluster_only_db0'));\n  this.selectedDbIndex = 0;\n  return;\n}\nif (!(Number.isInteger(this.selectedDbIndex) && this.selectedDbIndex >= 0 && this.selectedDbIndex < this.dbs.length)) {\n  this.selectedDbIndex = 0;\n}","typeGuard":"const isClusterClient = (client) => Boolean(client && typeof client.nodes === 'function');","tryCatchPattern":null,"preventionTips":["Detect cluster connections up front and lock the DB selector to 0","Cache CONFIG GET databases to bound valid indexes","Reset UI state to db0 whenever SELECT fails so client and server stay in sync"],"tags":["redis","select","cluster-mode","db-index"],"backgroundTag":"redis-cluster-select-disabled","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}