{"record":{"id":"c9441d9301529fc2","repo":"qishibo/AnotherRedisDesktopManager","slug":"this-t-message-value-exists","errorCode":null,"errorMessage":"this.$t('message.value_exists')","messagePattern":"this\\.\\$t\\('message\\.value_exists'\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/contents/KeyContentSet.vue","lineNumber":249,"sourceCode":"          // edit line\n          if (before.value) {\n            this.$set(this.setData, this.setData.indexOf(before), newLine);\n          }\n          // new line\n          else {\n            this.setData.push(newLine);\n            this.total++;\n          }\n\n          this.$message.success({\n            message: this.$t('message.add_success'),\n            duration: 1000,\n          });\n        }\n\n        // value exists\n        else if (reply == 0) {\n          this.$message.error({\n            message: this.$t('message.value_exists'),\n            duration: 1000,\n          });\n        }\n      }).catch((e) => { this.$message.error(e.message); });\n    },\n    deleteLine(row) {\n      this.$confirm(\n        this.$t('message.confirm_to_delete_row_data'),\n        { type: 'warning' },\n      ).then(() => {\n        this.client.srem(\n          this.redisKey,\n          row.value,\n        ).then((reply) => {\n          if (reply == 1) {\n            this.$message.success({\n              message: this.$t('message.delete_success'),","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/contents/KeyContentSet.vue#L231-L267","documentation":"Application-level toast ('Value Already Exists') in KeyContentSet.vue:249. SADD resolved successfully but reply == 0: Redis reports the number of members actually added, so 0 means every submitted member was already present. This is a semantic conflict, not a transport or protocol failure — nothing was written and the set is unchanged.","triggerScenarios":"SADD key member returns 0 when the exact member bytes already exist: re-adding a row visible in the current page, adding a member another operator just inserted, whitespace/case-identical duplicates, or submitting the dialog twice (double-click on save).","commonSituations":"Duplicate suppression workflows where the GUI is used to re-insert known tags/ids; two users curating the same set; stale page showing the member as absent after a filter.","solutions":["Treat as expected behavior for sets: search the current page (or SISMEMBER in console) to confirm the member is present","Clear the filter and reload the key so the existing member becomes visible","If the duplicate is unintended, edit the value first so the member differs before saving","Guard the save button against double-submits to avoid confusing repeats"],"exampleFix":"// before\nthis.client.sadd(this.redisKey, value).then((reply) => {\n  if (reply > 0) { /* added */ }\n  else if (reply == 0) { this.$message.error(this.$t('message.value_exists')); }\n});\n\n// after: pre-check to give a precise message and keep dialog contents\nconst exists = await this.client.sismember(this.redisKey, value);\nif (exists) {\n  this.$message.warning(this.$t('message.value_exists'));\n  return;\n}","handlingStrategy":"validation","validationCode":"// SISMEMBER before SADD to get a precise duplicate warning\nconst member = value; // Buffer or string exactly as SADD would send it\nconst exists = await this.client.sismember(this.redisKey, member);\nif (exists) {\n  this.$message.warning(this.$t('message.value_exists'));\n  return;\n}\nawait this.client.sadd(this.redisKey, member);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Search the loaded page (or run SISMEMBER) before re-adding known members","Keep the add-dialog open on reply==0 so the value can be tweaked","Disable the save button while the SADD promise is in flight to prevent double submits"],"tags":["redis","sadd","duplicate-member","ui-toast","ardm"],"backgroundTag":"redis-duplicate-member","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}