{"record":{"id":"dd5c451db5990782","repo":"qishibo/AnotherRedisDesktopManager","slug":"fail-to-load-proto-e-message","errorCode":null,"errorMessage":"Fail to load proto: ${e.message}","messagePattern":"Fail to load proto: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/viewers/ViewerProtobuf.vue","lineNumber":196,"sourceCode":"        this.selectedType = this.types.length > 1 ? this.types[1] : 'Rawproto';\n\n        // protobuf decode failed\n        if (this.selectedType === 'Rawproto' || this.newContent === DECODE_FAILED) {\n          // restore mode, clear binding\n          // if (!persist) {\n          //   this.clearBinding();\n          // }\n          return false;\n        }\n\n        // protobuf decode success\n        if (persist) {\n          this.persistBinding();\n        }\n\n        return true;\n      }).catch((e) => {\n        this.$message.error(`Fail to load proto: ${e.message}`);\n        this.clearBinding();\n        return false;\n      }).finally(() => {\n        // release bookmarks if exists\n        release();\n      });\n    },\n    persistBinding() {\n      const redisKeyHex = this.keyHex;\n      if (!redisKeyHex || !this.proto.length) {\n        return;\n      }\n\n      storage.bindProtobufProfile(redisKeyHex, {\n        name: this.proto.map(p => path.basename(p)).join(', '),\n        paths: this.proto,\n        bookmarks: this.bookmarks,\n      });","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerProtobuf.vue#L178-L214","documentation":"Element UI toast shown when protobuf.load(paths) rejects while parsing the selected .proto file(s). protobufjs parses .proto grammar at runtime; it rejects with a tokenize/parse error (with filename, line, and column) for syntax errors, unresolved imports, or unreadable files. The catch also calls clearBinding(), so the failing key-to-proto profile is removed and must be reselected.","triggerScenarios":"Selecting a .proto with a syntax error (missing semicolon, bad proto2/proto3 declaration); a file that imports another .proto not present in the selected set or its include paths; selecting a file that is actually protobuf source trimmed/corrupted (truncated download); permission errors reading the file.","commonSituations":"Editing proto files in another tool and saving mid-edit; protos that compile only with protoc -I include paths, since protobuf.load here gets bare file paths with no import roots; CR/LF or BOM issues in hand-made files; switching proto versions where syntax changed.","solutions":["Read e.message — protobufjs reports file:line:column of the parse failure; fix that spot","Ensure imported .proto files are included in the multi-selection (the dialog allows multiSelections)","Run `protoc --proto_path=<dir> <file>.proto` locally to confirm the file is valid before selecting it","After fixing, reselect the files to rebuild the binding (it was cleared)"],"exampleFix":"// before\n}).catch((e) => {\n  this.$message.error(`Fail to load proto: ${e.message}`);\n  this.clearBinding();\n  return false;\n});\n\n// after - longer duration so the file:line detail is readable\n}).catch((e) => {\n  this.$message.error({ message: `Fail to load proto: ${e.message}`, duration: 10000 });\n  this.clearBinding();\n  return false;\n});","handlingStrategy":"try-catch","validationCode":"// validate the proto compiles before binding it\n// (run locally): protoc --proto_path=<dir> file.proto","typeGuard":null,"tryCatchPattern":"protobuf.load(paths).then((root) => { ... })\n  .catch((e) => {\n    // e.message contains file:line:column of the syntax error\n    this.$message.error({ message: `Fail to load proto: ${e.message}`, duration: 10000 });\n    this.clearBinding();\n    return false;\n  });","preventionTips":["Compile protos with protoc before selecting them in the viewer","Include imported files in the picker's multi-selection","Pin one proto syntax (proto2/proto3) per project and lint it in CI"],"tags":["protobuf","parse-error","file-io","vue"],"backgroundTag":"proto-parse-error","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}