{"record":{"id":"536d7e14d39d864a","repo":"qishibo/AnotherRedisDesktopManager","slug":"zlib-brotli-parse-failed","errorCode":null,"errorMessage":"Zlib Brotli Parse Failed!","messagePattern":"Zlib Brotli Parse Failed!","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/components/viewers/ViewerBrotli.vue","lineNumber":26,"sourceCode":"\nconst zlib = require('zlib');\n\nexport default {\n  components: { JsonEditor },\n  props: ['content'],\n  computed: {\n    newContent() {\n      const { formatStr } = this;\n\n      if (typeof formatStr === 'string') {\n        if (this.$util.isJson(formatStr)) {\n          return JSONbig.parse(formatStr);\n        }\n\n        return formatStr;\n      }\n\n      return 'Zlib Brotli Parse Failed!';\n    },\n    formatStr() {\n      return this.$util.zippedToString(this.content, 'brotli');\n    },\n  },\n  methods: {\n    getContent() {\n      const content = this.$refs.editor.getRawContent(true);\n      return zlib.brotliCompressSync(content);\n    },\n    copyContent() {\n      return this.formatStr;\n    },\n  },\n};\n</script>\n","sourceCodeStart":8,"sourceCodeEnd":43,"githubUrl":"https://github.com/qishibo/AnotherRedisDesktopManager/blob/c149855106628babcdfb7675a8e7ba9434d2492a/src/components/viewers/ViewerBrotli.vue#L8-L43","documentation":"Placeholder string shown in the brotli viewer when decompression fails. formatStr calls $util.zippedToString(content, 'brotli') → zlib.brotliDecompressSync, which parses the brotli bitstream format (no fixed magic bytes, unlike gzip). Any throw or empty output makes formatStr false and newContent renders 'Zlib Brotli Parse Failed!', meaning the stored bytes are not a decodable brotli stream.","triggerScenarios":"Viewing a key labeled brotli whose bytes were compressed with another algorithm or corrupted — brotliDecompressSync throws ERR_UNEXPECTED_EOF or similar; truncated stream after partial write; brotli output produced with custom parameters is still fine, but random/encrypted data is not; empty decompressed output also maps to false.","commonSituations":"Brotli used for HTTP-origin cached bodies that were also chunk-framed or hex-encoded before storing; misdetected content type; values written by newer Brotli encoders that rely on custom dictionaries not available to Node's zlib.","solutions":["Verify the writer used zlib.brotliCompressSync (or standard brotli) and stored the raw output","Hex-inspect for an outer encoding layer (hex/base64) left on the value","Check for truncation — brotli streams have no easy header, so compare stored byte length with the writer's output length","Switch viewer mode if the value is actually gzip/deflate"],"exampleFix":"// before\nreturn 'Zlib Brotli Parse Failed!';\n\n// after - propagate the zlib reason\ntry {\n  return zlib.brotliDecompressSync(buf).toString();\n} catch (e) {\n  return `Zlib Brotli Parse Failed: ${e.message}`;\n}","handlingStrategy":"type-guard","validationCode":"const ok = typeof this.$util.zippedToString(buf, 'brotli') === 'string';\nif (!ok) { /* fall back to hex viewer */ }","typeGuard":"// same predicate the app uses (src/util.js isBrotli)\nconst isBrotli = (buf) => typeof $util.zippedToString(buf, 'brotli') === 'string';","tryCatchPattern":null,"preventionTips":["Producers: store raw zlib.brotliCompressSync output only","Avoid custom brotli dictionaries the reader cannot supply","When detection fails, compare stored byte length with the writer's output to spot truncation"],"tags":["brotli","zlib","decompression","vue","redis-viewer"],"backgroundTag":"zlib-decompress-failed","analyzedSha":"c149855106628babcdfb7675a8e7ba9434d2492a","analyzedAt":"2026-08-22T09:06:28.613Z","schemaVersion":2},"datasetVersion":"2026-08-22T09:17:25.309Z"}