MuntashirAkon/AppManager · error · IOException
Gzip-compressed data is corrupt (uncompressed size mismatch)
Error message
Gzip-compressed data is corrupt (uncompressed size mismatch)
What it means
The .gz trailer also stores ISIZE, the uncompressed length modulo 2^32. read() throws IOException when the stored ISIZE differs from the number of bytes the inflater actually produced, meaning the decoded payload length does not match the member's declared size.
Solutions
- Recover the original file; the member is internally inconsistent and the data cannot be trusted.
- If handling concatenated members, enable decompressConcatenated=true so member boundaries are parsed correctly.
- Recompress with standard gzip/zlib if a custom tool produced the wrong ISIZE.
Example fix
// before GzipCompressorInputStream gz = new GzipCompressorInputStream(in); // after (multi-member files) GzipCompressorInputStream gz = new GzipCompressorInputStream(in, true);
Defensive patterns
Strategy: try-catch
Try / catch
try (InputStream gz = new GzipCompressorInputStream(rawIn, true)) {
IOUtils.copy(gz, out);
} catch (IOException e) {
if (e.getMessage().contains("uncompressed size mismatch")) {
// ISIZE disagrees with decoded bytes — treat the archive as damaged
throw new IOException("gzip member size mismatch; re-acquire archive", e);
}
throw e;
} Prevention
- Enable decompressConcatenated=true for files that may be concatenations of .gz members.
- Verify archive integrity (gzip -t) before programmatic decompression.
- Recompress with standard tools if a custom compressor produced the archive.
When it happens
Trigger: Truncated or extended deflate data; a trailer from a different member (mis-joined concatenated members); corruption of the last 8 bytes; custom compressors writing wrong ISIZE.
Common situations: Concatenating .gz files by naive byte concatenation without concatenated-mode enabled or with damaged boundaries; interrupted writes leaving a partial member with a stale trailer; non-conforming compression tools.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Gzip-compressed data is corrupt (CRC32 error)
- Gzip-compressed data is corrupt
- Unsupported compression method " + method + " in the .gz…
- Bad block header
- BZip2 block size is invalid
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/a772b0890515804f.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java:331
throw new IOException();
}
bufUsed = 0;
final DataInput inData = new DataInputStream(in);
// CRC32
final long crcStored = ByteUtils.fromLittleEndian(inData, 4);
if (crcStored != crc.getValue()) {
throw new IOException("Gzip-compressed data is corrupt (CRC32 error)");
}
// Uncompressed size modulo 2^32 (ISIZE in the spec)
final long isize = ByteUtils.fromLittleEndian(inData, 4);
if (isize != (inf.getBytesWritten() & 0xffffffffL)) {
throw new IOException("Gzip-compressed data is corrupt (uncompressed size mismatch)");
}
// See if this is the end of the file.
if (!decompressConcatenated || !init(false)) {
inf.end();
inf = null;
endReached = true;
return size == 0 ? -1 : size;
}
}
}
return size;
}
/**
* Checks if the signature matches what is expected for a .gz file.
*View on GitHub (pinned to 0152f468fc)