{"record":{"id":"5b5549235bf578c8","repo":"qishibo/AnotherRedisDesktopManager","slug":"select-a-correct-proto-file","errorCode":null,"errorMessage":"Select a correct .proto file","messagePattern":"Select a correct \\.proto file","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/viewers/ViewerProtobuf.vue","lineNumber":94,"sourceCode":"    },\n    buttonText() {\n      if (!this.proto.length) {\n        return 'Select Proto Files';\n      }\n\n      return this.proto.map(p => path.basename(p || '')).join(', ');\n    },\n    keyHex() {\n      return this.redisKey.toString('hex');\n    },\n  },\n  mounted() {\n    this.restoreBinding();\n  },\n  methods: {\n    getContent() {\n      if (!this.protoRoot) {\n        this.$message.error('Select a correct .proto file');\n        return false;\n      }\n\n      if (!this.selectedType || this.selectedType === 'Rawproto') {\n        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","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerProtobuf.vue#L76-L112","documentation":"Element UI toast shown in the Protobuf key viewer when getContent() is called while this.protoRoot is falsy. protoRoot is only set after protobuf.load() successfully parses the selected .proto files (ViewerProtobuf.vue loadProtoFiles), so this message means 'no .proto file is currently loaded/bound for this key'. getContent() returning false aborts the save/encode pipeline in the parent viewer.","triggerScenarios":"Opening a protobuf-encoded Redis key and clicking save/edit-apply before selecting a .proto file via the 'select proto' button; after loadProtoFiles failed (missing file or parse error) leaving protoRoot null and then attempting to submit content; restoreBinding() found no persisted profile so no root was loaded automatically.","commonSituations":"First-time use of the protobuf viewer without a bound .proto; the persisted profile was cleared after a failed load (clearBinding on error) and the user edits again without reselecting; switching between viewer tabs resets state.","solutions":["Click the select-proto button in the protobuf toolbar and choose a valid .proto file, then retry the operation","If you just selected a file, check for errors — a failed protobuf.load clears the binding; fix the .proto syntax and reselect","Verify the viewer is actually in Protobuf mode and not still showing raw bytes"],"exampleFix":"// Guard earlier: disable the save button until a proto root is loaded\n<el-button :disabled=\"!protoRoot\" @click=\"save\">Save</el-button>","handlingStrategy":"validation","validationCode":"if (!this.protoRoot) {\n  this.$message.error('Select a correct .proto file');\n  return false; // existing guard; keep save button disabled instead\n}","typeGuard":"// UI-level narrowing\nconst canEncode = (protoRoot, selectedType) =>\n  Boolean(protoRoot) && Boolean(selectedType) && selectedType !== 'Rawproto';","tryCatchPattern":null,"preventionTips":["Disable the save button until protoRoot is set","Bind a proto profile per key so protoRoot auto-loads on open","After any proto load failure, prompt to reselect immediately instead of leaving a null root"],"tags":["protobuf","vue","ui-validation","redis-viewer"],"backgroundTag":"missing-schema-file","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}