MuntashirAkon/AppManager · error · IOException
Initialised without a first member nor the…
Error message
Initialised without a first member nor the decompressConcatenated is enabled
What it means
GzipCompressorInputStream.init(isFirstMember) throws this when asked to start a subsequent .gz member while decompressConcatenated is disabled and isFirstMember is false. The stream has finished one member and, because concatenation support is off, reading further input is not allowed.
Solutions
- Construct GzipCompressorInputStream with decompressConcatenated=true: new GzipCompressorInputStream(in, true).
- If concatenated output is not desired, stop reading at the first member and discard/inspect trailing bytes.
- Use CompressorStreamFactory with decompressConcatenated enabled for transparent multi-member handling.
Example fix
// before GzipCompressorInputStream gz = new GzipCompressorInputStream(in); // after GzipCompressorInputStream gz = new GzipCompressorInputStream(in, true); // concatenated members
Defensive patterns
Strategy: validation
Validate before calling
boolean concatenated = true; // if input may contain multiple .gz members InputStream gz = new GzipCompressorInputStream(rawIn, concatenated);
Try / catch
try (InputStream gz = new GzipCompressorInputStream(rawIn, true)) {
IOUtils.copy(gz, out);
} catch (IOException e) {
if (e.getMessage().contains("decompressConcatenated")) {
// reopen with concatenated mode enabled
} else {
throw e;
}
} Prevention
- Enable decompressConcatenated=true whenever input provenance is unknown or shell-produced (gzip cat semantics).
- Check for trailing bytes after the first member if concatenation is disabled.
- Document the constructor flag choice in the code that creates gzip streams.
When it happens
Trigger: Reading a multi-member (concatenated) .gz file constructed with decompressConcatenated=false; calling read() after the first member's trailer when trailing bytes exist.
Common situations: Files produced by `gzip` of concatenated data or by `tar czf` with multiple passes; users expecting cat-like concatenation semantics but having passed false to the decompressConcatenated constructor flag.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Invalid gzip compression level: " + compressionLevel
- Block size must be a multiple of 512 bytes. Attempt to use…
- blockSize(" + blockSize + ") < 1
- Cannot write more data, the end of the compressed data…
- Gzip-compressed data is corrupt
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/b4403d895c343da8.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java:163
this.decompressConcatenated = decompressConcatenated;
init(true);
}
/**
* Provides the stream's meta data - may change with each stream
* when decompressing concatenated streams.
*
* @return the stream's meta data
* @since 1.8
*/
public GzipParameters getMetaData() {
return parameters;
}
private boolean init(final boolean isFirstMember) throws IOException {
if (!isFirstMember && !decompressConcatenated) {
throw new IOException("Initialised without a first member nor the decompressConcatenated is enabled");
}
// Check the magic bytes without a possibility of EOFException.
final int magic0 = in.read();
// If end of input was reached after decompressing at least
// one .gz member, we have reached the end of the file successfully.
if (magic0 == -1 && !isFirstMember) {
return false;
}
if (magic0 != 31 || in.read() != 139) {
throw new IOException(isFirstMember ? "Input is not in the .gz format"
: "Garbage after a valid .gz stream");
}
// Parsing the rest of the header may throw EOFException.
final DataInput inData = new DataInputStream(in);View on GitHub (pinned to 0152f468fc)