{"record":{"id":"caed5b37e35ed30d","repo":"qishibo/AnotherRedisDesktopManager","slug":"proto-verify-failed-err","errorCode":null,"errorMessage":"Proto Verify Failed: ${err}","messagePattern":"Proto Verify Failed: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/viewers/ViewerProtobuf.vue","lineNumber":117,"sourceCode":"        this.$message.error('Select a correct Type to encode');\n        return false;\n      }\n\n      let content = this.$refs.editor.getRawContent();\n      const type = this.protoRoot.lookupType(this.selectedType);\n\n      try {\n        content = JSON.parse(content);\n      } catch (e) {\n        this.$message.error(this.$t('message.json_format_failed'));\n        return false;\n      }\n\n      // toJSON() shows int64/uint64 as strings; fromObject converts them back\n      const message = type.fromObject(content);\n      const err = type.verify(message);\n      if (err) {\n        this.$message.error(`Proto Verify Failed: ${err}`);\n        return false;\n      }\n\n      return type.encode(message).finish();\n    },\n    copyContent() {\n      return JSON.stringify(this.newContent);\n    },\n    selectProto() {\n      dialog.showOpenDialog({\n        securityScopedBookmarks: true,\n        properties: ['openFile', 'multiSelections'],\n        filters: [\n          {\n            name: '.proto',\n            extensions: ['proto'],\n          },\n        ],","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerProtobuf.vue#L99-L135","documentation":"Element UI toast shown when protobufjs type.verify(message) returns a non-null error string after type.fromObject(content) builds the message. verify() is protobufjs's runtime schema check: it reports missing required fields, wrong scalar types, and invalid enum values, returning a descriptive string like 'FieldX: illegal value' or '.message.field: required field missing' which is interpolated into this toast.","triggerScenarios":"Deleting a field marked `required` in the .proto from the edited JSON and saving; typing a string into an int32 field (fromObject coerces where it can, verify catches what it cannot); setting an enum field to a name or number not declared in the enum; assigning an object where a repeated scalar array is expected.","commonSituations":"Editing decoded messages whose schema has required fields; hand-crafting enum values; schema drift — the Redis value was written with an older .proto that had different field types than the currently bound one.","solutions":["Read the err string in the toast: it names the exact field and the violation (required missing / illegal value)","Fix the named field in the JSON editor (restore required fields, correct the type, use a valid enum name)","If the schema itself changed, reselect the .proto that matches how the data was written","Add editor-side JSON-schema validation generated from the proto to catch issues before save"],"exampleFix":"// before\nconst err = type.verify(message);\nif (err) {\n  this.$message.error(`Proto Verify Failed: ${err}`);\n  return false;\n}\n\n// after - keep the object so the user can correct it without losing edits\nconst err = type.verify(message);\nif (err) {\n  this.$message.error({ message: `Proto Verify Failed: ${err}`, duration: 6000 });\n  return false;\n}","handlingStrategy":"validation","validationCode":"const message = type.fromObject(content);\nconst err = type.verify(message);\nif (err) {\n  this.$message.error(`Proto Verify Failed: ${err}`);\n  return false;\n}","typeGuard":"// protobufjs convention: verify returns null when valid\nconst isValidMessage = (type, msg) => type.verify(msg) === null;","tryCatchPattern":null,"preventionTips":["Always run type.verify() after fromObject() before encode() — encode() throws unhelpfully on bad values","Keep required fields present when hand-editing decoded JSON","Keep the bound .proto in sync with the schema that wrote the data"],"tags":["protobuf","schema-validation","vue","user-input"],"backgroundTag":"schema-validation-failed","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}