{"record":{"id":"43ac429edb28f314","repo":"awslabs/llrt","slug":"failed-to-decompress","errorCode":null,"errorMessage":"failed to decompress","messagePattern":"failed to decompress","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"llrt/src/main.c","lineNumber":232,"sourceCode":"  DecompressThreadArgs args[parts];\n  for (uint32_t i = 0; i < parts; i++)\n  {\n    args[i].inputBuffer = compressedData + inputOffset;\n    args[i].outputBuffer = uncompressed + outputOffset;\n    args[i].srcSize = inputSizes[i];\n    args[i].dstSize = outputSizes[i];\n    args[i].id = i;\n    inputOffset += inputSizes[i];\n    outputOffset += outputSizes[i];\n    if (parts > 1)\n    {\n      pthread_create(&threads[i], NULL, decompressPartial, (void *)&args[i]);\n    }\n    else\n    {\n      if (decompressPartial((void *)&args[i]) > 0)\n      {\n        err(1, \"failed to decompress\");\n      }\n    }\n  }\n\n  if (parts > 1)\n  {\n    for (uint8_t i = 0; i < parts; i++)\n    {\n      void *result;\n      pthread_join(threads[i], &result);\n    }\n  }\n\n  *uncompressedData = uncompressed;\n}\n\nint main(int argc, char *argv[])\n{","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/awslabs/llrt/blob/742fc00b82cbeaab1c1b76f0d706c302a5cbc306/llrt/src/main.c#L214-L250","documentation":"decompress() splits the embedded compressed payload into `parts` chunks and decompresses each via decompressPartial (in worker threads when parts > 1, inline otherwise). This error is raised when decompressPartial returns > 0 on the non-threaded (single-part) path, meaning one chunk failed to decompress. The payload is unusable and the runtime aborts before ever reaching user code.","triggerScenarios":"decompressPartial returns a positive status for a chunk — the LZ4/zstd-compressed slice is corrupt, the inputSizes/outputSizes computed by readData don't match the actual data, the binary was modified/truncated after build (patching shifts the payload), or a build tool mis-embedded the compressed app.","commonSituations":"Binary corrupted by download over text/FTP mode, anivirus or signing tools rewriting the executable, post-build patching tools (e.g. rpath/editbin) changing file offsets, or a self-built llrt where the bundling step produced a mismatched size table.","solutions":["Re-download or rebuild the llrt binary from a clean source; verify its checksum against the official release.","Ensure no post-processing (antivirus quarantine/repair, code signers, binary patchers) altered the executable after build.","If self-built, rebuild without modifying the binary after the bundle/append step, since offsets in readData depend on exact layout.","Retry the download over a binary-safe channel (avoid ASCII transfer modes, proxies that rewrite content)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Validate the binary before running: compare against the published checksum.\nimport { createHash } from 'node:crypto';\nimport { readFileSync } from 'node:fs';\nimport { execFileSync } from 'node:child_process';\nconst sha = createHash('sha256').update(readFileSync('./llrt')).digest('hex');\nif (sha !== EXPECTED_SHA256) throw new Error('llrt binary corrupted — decompression would fail');","typeGuard":null,"tryCatchPattern":"try {\n  child_process.execFileSync('./llrt', ['app.js']);\n} catch (e) {\n  if (e.status === 1 && /failed to decompress/.test(String(e.stderr))) {\n    // re-download/reinstall the binary, then retry\n  }\n}","preventionTips":["Always verify checksums/signatures of downloaded llrt binaries.","Download in binary-safe mode; never through text-mangling transfer or rewriting proxies.","Do not patch or post-process the executable after build (offsets in the embedded payload depend on exact layout).","Exclude the binary from antivirus/EDR auto-remediation."],"tags":["decompression","corrupt-binary","checksum","self-extraction"],"backgroundTag":"decompression-failed","analyzedSha":"742fc00b82cbeaab1c1b76f0d706c302a5cbc306","analyzedAt":"2026-09-12T11:14:07.838Z","contentChangedAt":"2026-09-12T11:14:07.838Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}