{"record":{"id":"2ae5fa7344d7d90b","repo":"ruvnet/ruflo","slug":"zstd-decompression-is-not-supported-in-this-enviro","errorCode":null,"errorMessage":"zstd decompression is not supported in this environment","messagePattern":"zstd decompression is not supported in this environment","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/appliance/rvfa-format.ts","lineNumber":429,"sourceCode":"    if (!sec) {\n      throw new Error(`Section \"${id}\" not found`);\n    }\n\n    if (sec.offset + sec.size > this.buf.length - SHA256_SIZE) {\n      throw new Error(`Section \"${id}\" exceeds buffer bounds`);\n    }\n\n    const raw = this.buf.subarray(sec.offset, sec.offset + sec.size);\n\n    if (sec.compression === 'gzip') {\n      return gunzipSync(raw);\n    }\n    if (sec.compression === 'zstd') {\n      // zstd not natively supported — attempt gzip fallback (mirrors writer)\n      try {\n        return gunzipSync(raw);\n      } catch {\n        throw new Error(\n          'zstd decompression is not supported in this environment',\n        );\n      }\n    }\n\n    // compression === 'none'\n    return Buffer.from(raw);\n  }\n\n  /**\n   * Verify the integrity of the RVFA image.\n   *\n   * Checks:\n   *  1. Magic bytes\n   *  2. Version number\n   *  3. SHA256 of each section's compressed data\n   *  4. SHA256 footer (all section data combined)\n   */","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/appliance/rvfa-format.ts#L411-L447","documentation":"extractSection hit a section with compression === 'zstd'. Node core has no zstd support, so the reader attempts gunzipSync as a fallback (mirroring RvfaWriter, which silently downgrades zstd requests to gzip); if the bytes aren't gzip either, this error is thrown. Images written by RvfaWriter never contain real zstd sections — the downgrade guarantees compression==='gzip' — so a genuine zstd section means the image came from an external tool.","triggerScenarios":"extractSection(id) where header.sections[i].compression === 'zstd' AND the payload is actual zstd (not gzip). Happens with .rvfa images produced by third-party/Rust tooling that wrote real zstd frames, then consumed by this Node reader.","commonSituations":"Mixed toolchains: an appliance built with a Rust/Go packager (native zstd) read back by @claude-flow/cli; newer external tools defaulting to zstd for better ratio; CI promoting images between heterogeneous builders and readers.","solutions":["Rebuild or re-pack the image with compression 'gzip' or 'none' — RvfaWriter.addSection(id, data, { compression: 'gzip' }) — since the Node reader fully supports those","Pre-check the section's compression field (reader.getSections()) and shell out to an external zstd binary for those sections instead of calling extractSection","If you control the external writer, disable zstd or emit gzip for compatibility with this reader","Track the upstream limitation: any real zstd support would require a native module (e.g. @mongodb-js/zstd or fzstd), absent from this implementation"],"exampleFix":"// before — extractSection throws on zstd sections\nconst data = reader.extractSection('kernel');\n\n// after — branch on the declared compression\nconst sec = reader.getSections().find((s) => s.id === 'kernel')!;\nif (sec.compression === 'zstd') {\n  const raw = fs.readFileSync(path).subarray(sec.offset, sec.offset + sec.size);\n  data = zstdDecompress(raw); // external zstd implementation\n} else {\n  data = reader.extractSection('kernel');\n}","handlingStrategy":"fallback","validationCode":"const sec = reader.getSections().find((s) => s.id === id);\nif (sec?.compression === 'zstd') {\n  throw new Error('zstd section needs an external decompressor');\n}","typeGuard":"function isExtractableHere(sec: { compression: string }): boolean {\n  return sec.compression === 'none' || sec.compression === 'gzip';\n}","tryCatchPattern":"try { data = reader.extractSection(id); }\ncatch (e) {\n  if (/zstd decompression is not supported/.test(String((e as Error).message))) {\n    // fallback: decompress sec's raw range with an external zstd implementation\n  }\n  throw e;\n}","preventionTips":["Build images with compression 'gzip' or 'none' when this Node reader will consume them","Pre-check section.compression via getSections() before extracting","Standardize the toolchain: any real-zstd writer will be unreadable here"],"tags":["rvfa","zstd","compression","environment-limitation"],"backgroundTag":"unsupported-compression-format","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}