Zstd decompression error - Unknown frame descriptor

Viewed 2450

I'm trying to decompress a .zst file the following way :

public byte[] decompress() {
byte[] compressedBytes = Files.readAllBytes(Paths.get(PATH_TO_ZST));
final long size = Zstd.decompressedSize(compressedBytes);
return Zstd.decompress(compressedBytes, (int)size);
}

and I'm running into this :

com.github.luben.zstd.ZstdException: Unknown frame descriptor [java] com.github.luben.zstd.ZstdDecompressCtx.decompressByteArray(ZstdDecompressCtx.java:157) [java] com.github.luben.zstd.ZstdDecompressCtx.decompress(ZstdDecompressCtx.java:214) [java]

Has anyone faced something similar? Thanks!

1 Answers

That error means zstd doesn't recognize the first 4 bytes of the frame. This can be because either:

  1. The data is not in zstd format,
  2. There is excess data at the end of the zstd frame.

You'll also want to check the output of Zstd.decompressedSize() for 0, which means the frame is corrupted, or the size wasn't present in the frame header. See the documentation.

Related