{"record":{"id":"81f000a1d34e83a3","repo":"qishibo/AnotherRedisDesktopManager","slug":"client-on-error-error-config-right","errorCode":null,"errorMessage":"Client On Error: ${error} Config right?","messagePattern":"Client On Error: (.+?) Config right\\?","errorType":"console","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/components/ConnectionWrapper.vue","lineNumber":180,"sourceCode":"\n      // ssh client\n      if (configCopy.sshOptions) {\n        var clientPromise = redisClient.createSSHConnection(\n          configCopy.sshOptions, configCopy.host, configCopy.port, configCopy.auth, configCopy,\n        );\n      }\n      // normal client\n      else {\n        var clientPromise = redisClient.createConnection(\n          configCopy.host, configCopy.port, configCopy.auth, configCopy,\n        );\n      }\n\n      clientPromise.then((client) => {\n        this.client = client;\n\n        client.on('error', (error) => {\n          this.$message.error({\n            message: `Client On Error: ${error} Config right?`,\n            duration: 3000,\n            customClass: 'redis-on-error-message',\n          });\n\n          this.$bus.$emit('closeConnection');\n        });\n      }).catch((error) => {\n        this.$message.error(error.message);\n        this.$bus.$emit('closeConnection');\n      });\n\n      return clientPromise;\n    },\n    setColor(color, save = true) {\n      const ulDom = this.$refs.connectionMenu.$el;\n      const className = 'menu-with-custom-color';\n","sourceCodeStart":162,"sourceCodeEnd":198,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/ConnectionWrapper.vue#L162-L198","documentation":"The connected Redis client emitted its 'error' event — node_redis/ioredis surface every socket- and protocol-level failure here: ECONNRESET on dropped connections, ECONNREFUSED after a server restart, 'ERR invalid password' at handshake, or malformed replies. The handler shows the message and broadcasts closeConnection, tearing the connection tab down. The listener is also a crash guard: an unhandled 'error' event on an EventEmitter would throw and kill the renderer process.","triggerScenarios":"Server restart or network blip while a connection tab is open; wrong password saved in the config (ERR invalid password on connect); LB reaping idle sockets; Redis sending unexpected protocol bytes.","commonSituations":"Long-lived desktop sessions over VPN, servers restarted under the user, stale configs after password rotation, flaky corporate networks.","solutions":["Read the embedded cause in the message: fix credentials for ERR invalid password, reachability for ECONNREFUSED/ECONNRESET","Reconnect with the corrected config after closeConnection instead of leaving the tab dead","Configure retryStrategy/maxRetriesPerRequest on the client so transient resets recover instead of bubbling here","Keep the listener attached for the client's lifetime (removing it risks unhandled 'error' crashes)"],"exampleFix":"// before\nclient.on('error', (error) => {\n  this.$message.error({ message: `Client On Error: ${error} Config right?`, duration: 3000 });\n  this.$bus.$emit('closeConnection');\n});\n\n// after\nclient.on('error', (error) => {\n  const msg = String(error && error.message ? error.message : error);\n  if (/invalid password|NOAUTH/i.test(msg)) {\n    this.$message.error(`Auth failed: ${msg}`);\n  } else if (/ECONNRESET|ECONNREFUSED|ETIMEDOUT/.test(msg)) {\n    this.$message.error(`Connection lost: ${msg}`);\n  } else {\n    this.$message.error(`Client On Error: ${msg} Config right?`);\n  }\n  this.$bus.$emit('closeConnection');\n});","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"client.on('error', (err) => {\n  const m = String(err && err.message ? err.message : err);\n  if (/ECONNRESET|ETIMEDOUT/.test(m)) { /* transient: let retryStrategy recover */ }\n  else if (/invalid password|NOAUTH|AUTH/i.test(m)) { /* fix config, reconnect */ }\n  else {\n    this.$message.error(`Client On Error: ${m} Config right?`);\n    this.$bus.$emit('closeConnection');\n  }\n});","preventionTips":["Always attach an 'error' listener before issuing commands — missing handlers crash Node","Use retryStrategy with capped backoff for transient socket errors","Validate credentials once at connect so wrong passwords fail fast","Tear down UI state on unrecoverable errors to avoid zombie tabs"],"tags":["redis","client-error-event","econnreset","invalid-password","node-redis"],"backgroundTag":"redis-client-error-event","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}