Skip to content

Document xz-embedded limitations and/or improve error messaging #2

@ariofrio

Description

@ariofrio

I'm getting the following error:

error: Uncaught (in promise) Error: get_next_output failed with error code 7
    at XzContext.getNextOutput (file:///~/Library/Caches/deno/npm/registry.npmjs.org/xz-decompress/0.2.1/dist/package/xz-decompress.js:159:19)
    at Object.pull (file:///~/Library/Caches/deno/npm/registry.npmjs.org/xz-decompress/0.2.1/dist/package/xz-decompress.js:246:50)
    at eventLoopTick (ext:core/01_core.js:183:11)

This was puzzling, and at first I thought it was another issue with WASM compatibility but I looked into the source code and found out the following:

This is an error thrown by the xz-embedded library itself

Error code 7 refers to "XZ_DATA_ERROR: Compressed data is corrupt." It may be good to include descriptive error messages in the Error for ease of troubleshooting. Here are the xz binary's error messages.

The xz-embedded library is pretty limited

/*
 * This is really limited: Not all filters from .xz format are supported,
 * only CRC32 is supported as the integrity check, and decoding of
 * concatenated .xz streams is not supported. Thus, you may want to look
 * at xzdec from XZ Utils if a few KiB bigger tool is not a problem.
 */

For my use case of decompressing CrUX dumps, the problem was that the XZ archives used LZMA2:26 CRC64 (according to 7z l) rather than CRC32. It might be good to reproduce this warning in the README.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions