{"record":{"id":"5aa4010bf775ae3b","repo":"qishibo/AnotherRedisDesktopManager","slug":"raw-content-is-an-object-but-now-parse-object-fai","errorCode":null,"errorMessage":"Raw content is an object, but now parse object failed: ${e.message}","messagePattern":"Raw content is an object, but now parse object failed: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/components/viewers/ViewerMsgpack.vue","lineNumber":34,"sourceCode":"    newContent() {\n      try {\n        return decode(this.content);\n      } catch (e) {\n        return this.$t('message.msgpack_format_failed');\n      }\n    },\n  },\n  methods: {\n    getContent() {\n      let content = this.$refs.editor.getRawContent();\n\n      // raw content is an object\n      if (typeof this.newContent !== 'string') {\n        try {\n          content = JSONbig.parse(content);\n        } catch (e) {\n          // object parse failed\n          this.$message.error({\n            message: `Raw content is an object, but now parse object failed: ${e.message}`,\n            duration: 6000,\n          });\n\n          return false;\n        }\n      }\n\n      // encode returns Uint8Array\n      return Buffer.from(encode(content));\n    },\n    copyContent() {\n      const content = decode(this.content);\n      return (typeof content === 'object') ? JSONbig.stringify(content) : content;\n    },\n  },\n};\n</script>","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerMsgpack.vue#L16-L52","documentation":"Element UI toast (6s duration) shown when re-encoding an edited msgpack value: the raw content from the editor is expected to be JSON (because the original decoded value was an object, not a string), and JSONbig.parse(content) throws. JSONbig is used to preserve big integers exactly; a syntax error in the edited JSON text aborts before @msgpack/msgpack's encode() runs, and getContent() returns false to block the write.","triggerScenarios":"Opening a msgpack-encoded Redis key whose decoded value is an object, editing the JSON in the editor, introducing a syntax error (trailing comma, missing quote, unbalanced brace), then saving; pasting non-JSON text into the editor; truncating the JSON mid-edit and submitting.","commonSituations":"Hand-editing nested msgpack documents; values with very large int64 fields are fine (JSONbig keeps precision) but relaxed JSON (comments, single quotes) is not; collaborative edits pasted from notes apps that mangle quotes.","solutions":["Correct the JSON syntax error and save again","Run the editor's format/pretty-print action to pinpoint the syntax error location","Validate externally (jq or a JSON linter) then paste back","Improvement: include e.message (JSONbig reports position) in the toast to locate the error"],"exampleFix":"// before\nthis.$message.error({\n  message: `Raw content is an object, but now parse object failed: ${e.message}`,\n  duration: 6000,\n});\n\n// after\n// surface position clearly\nthis.$message.error({\n  message: `Invalid JSON in editor: ${e.message}`,\n  duration: 6000,\n});","handlingStrategy":"try-catch","validationCode":"// validate before encode\ntry {\n  JSONbig.parse(this.$refs.editor.getRawContent());\n} catch (e) {\n  this.$message.error(`Invalid JSON: ${e.message}`);\n  return;\n}","typeGuard":"const isParsableJSONbig = (s) => {\n  try { JSONbig.parse(s); return true; } catch { return false; }\n};","tryCatchPattern":"try {\\n  content = JSONbig.parse(content);\\n} catch (e) {\\n  this.$message.error({ message: `Raw content is an object, but now parse object failed: ${e.message}`, duration: 6000 });\\n  return false; // block the write, preserve editor contents\\n}","preventionTips":["Pretty-print/format the JSON before editing to reduce bracket mistakes","Debounce-validate JSON in the editor and mark errors inline","Do not mix relaxed JSON syntax into the msgpack object editor"],"tags":["msgpack","json","vue","user-input","bigint"],"backgroundTag":"json-parse-error","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}