{"record":{"id":"9d1642e16fd2de49","repo":"qishibo/AnotherRedisDesktopManager","slug":"this-rediskey-this-t-message-delete-failed","errorCode":null,"errorMessage":"${this.redisKey} ${this.$t('message.delete_failed')}","messagePattern":"\\$\\{this\\.redisKey\\} \\$\\{this\\.\\$t\\('message\\.delete_failed'\\)\\}","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/KeyHeader.vue","lineNumber":143,"sourceCode":"      this.$emit('dumpCommand');\n    },\n    deleteKey() {\n      this.$confirm(\n        this.$t('message.confirm_to_delete_key', { key: this.$util.bufToString(this.redisKey) }),\n        { type: 'warning' },\n      )\n        .then(() => {\n          this.client.del(this.redisKey).then((reply) => {\n            if (reply == 1) {\n              this.$message.success({\n                message: this.$t('message.delete_success'),\n                duration: 1000,\n              });\n\n              this.$bus.$emit('removePreTab');\n              this.refreshKeyList(this.redisKey);\n            } else {\n              this.$message.error({\n                message: `${this.redisKey} ${this.$t('message.delete_failed')}`,\n                duration: 1000,\n              });\n            }\n          }).catch((e) => { this.$message.error(e.message); });\n        }).catch(() => {});\n    },\n    renameKey(e) {\n      // input blur to prevent trigger twice by enter\n      e && e.srcElement.blur();\n\n      if (this.keyName.equals(this.redisKey)) {\n        return;\n      }\n\n      const inputTxt = 'y';\n      const placeholder = this.$t('message.flushdb_prompt', { txt: inputTxt });\n","sourceCodeStart":125,"sourceCodeEnd":161,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/KeyHeader.vue#L125-L161","documentation":"KeyHeader.vue delete flow: after user confirmation, client.del(redisKey) resolves with the number of keys removed; reply != 1 means the source key no longer existed (expired or deleted elsewhere), so the '<key> delete_failed' toast is shown. The DEL succeeded but removed nothing, and the tab stays open because removePreTab is only called on success.","triggerScenarios":"Key expired between opening the tab and pressing delete; key deleted from another session/tool; tab left open on a key with a short TTL.","commonSituations":"Multiple GUI sessions or an app deleting keys while the tab is open; TTLs expiring during analysis workflows.","solutions":["Refresh the key list - the key will be gone from it.","Close the stale tab manually (it does not auto-close on this path).","If the key still exists after refresh, retry the delete."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const exists = await client.exists(this.redisKey);\nif (!exists) { this.$bus.$emit('removePreTab'); this.refreshKeyList(this.redisKey); return; }","typeGuard":"const wasDeleted = (reply) => reply === 1;","tryCatchPattern":"this.client.del(this.redisKey).then((reply) => {\n  if (wasDeleted(reply)) { /* success: removePreTab */ }\n  else {\n    // key already gone server-side: close the stale tab and refresh instead of erroring\n    this.$bus.$emit('removePreTab');\n    this.refreshKeyList(this.redisKey);\n  }\n});","preventionTips":["Treat DEL reply 0 as 'key already gone': close the tab and refresh rather than showing delete_failed.","Re-check existence for keys with TTLs before destructive actions from stale tabs."],"tags":["del","key-not-found","race-condition","stale-tab"],"backgroundTag":"redis-key-not-found","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}