{"record":{"id":"51a878a872d63fdd","repo":"qishibo/AnotherRedisDesktopManager","slug":"element-is-required","errorCode":null,"errorMessage":"Element is required","messagePattern":"Element is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/contents/KeyContentVector.vue","lineNumber":352,"sourceCode":"\n      // load vector & attrs when edit\n      if (this.isEdit) {\n        this.loadElementDetail(row.element).then((detail) => {\n          this.$set(this.editLineItem, 'vectorText', detail.vectorText);\n          this.$set(this.editLineItem, 'attrs', detail.attrs);\n        }).catch((e) => {\n          this.$message.error(e.message);\n        });\n      }\n    },\n    editLine() {\n      const before = this.beforeEditItem;\n      const element = (this.editLineItem.element || '').trim();\n      const vector = this.parseVectorText(this.editLineItem.vectorText);\n      const attrs = (this.editLineItem.attrs || '').trim();\n\n      if (!element) {\n        return this.$message.error('Element is required');\n      }\n      if (!vector || !vector.length) {\n        return this.$message.error('Vector is required');\n      }\n      if (this.dim && vector.length !== this.dim) {\n        return this.$message.error(`Vector dimension must be ${this.dim}`);\n      }\n      if (attrs && !this.$util.isJson(attrs)) {\n        return this.$message.error('Attributes must be valid JSON');\n      }\n\n      this.editDialog = false;\n\n      const vaddArgs = [this.redisKey, 'VALUES', vector.length, ...vector, element];\n      // must match existing set quant-type, otherwise: ERR asked quantization mismatch\n      const quantOpt = this.getQuantOption();\n      quantOpt && vaddArgs.push(quantOpt);\n","sourceCodeStart":334,"sourceCodeEnd":370,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/contents/KeyContentVector.vue#L334-L370","documentation":"Client-side form validation in the VADD dialog: the element name (the string identifying the vector) is empty after trim, so no command is sent. The element is the vector set's member key — Redis requires it, so the client blocks the call early.","triggerScenarios":"Adding a new element with an empty name; a name of only spaces; editing a row whose element was binary and rendered as an empty string.","commonSituations":"Quick-adding a vector without naming it; binary element names losing their display form in the table.","solutions":["Enter a non-empty element name (surrounding whitespace is trimmed)","For binary element names, paste the exact original value (e.g. from the row's VADD dump command)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const element = (this.editLineItem.element || '').trim();\nif (!element) {\n  return this.$message.error('Element is required');\n}","typeGuard":"const isNonEmptyString = (v) => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Trim and check required identifiers before building the Redis command","Disable the submit button while required fields are empty instead of erroring on click","For binary member names, carry the raw buffer through instead of a lossy string round-trip"],"tags":["validation","form","vector-sets","required-field"],"backgroundTag":"required-field-missing","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}