{"record":{"id":"b4403d895c343da8","repo":"MuntashirAkon/AppManager","slug":"initialised-without-a-first-member-nor-the","errorCode":null,"errorMessage":"Initialised without a first member nor the decompressConcatenated is enabled","messagePattern":"Initialised without a first member nor the decompressConcatenated is enabled","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java","lineNumber":163,"sourceCode":"\n        this.decompressConcatenated = decompressConcatenated;\n        init(true);\n    }\n\n    /**\n     * Provides the stream's meta data - may change with each stream\n     * when decompressing concatenated streams.\n     *\n     * @return the stream's meta data\n     * @since 1.8\n     */\n    public GzipParameters getMetaData() {\n        return parameters;\n    }\n\n    private boolean init(final boolean isFirstMember) throws IOException {\n        if (!isFirstMember && !decompressConcatenated) {\n            throw new IOException(\"Initialised without a first member nor the decompressConcatenated is enabled\");\n        }\n\n        // Check the magic bytes without a possibility of EOFException.\n        final int magic0 = in.read();\n\n        // If end of input was reached after decompressing at least\n        // one .gz member, we have reached the end of the file successfully.\n        if (magic0 == -1 && !isFirstMember) {\n            return false;\n        }\n\n        if (magic0 != 31 || in.read() != 139) {\n            throw new IOException(isFirstMember ? \"Input is not in the .gz format\"\n                    : \"Garbage after a valid .gz stream\");\n        }\n\n        // Parsing the rest of the header may throw EOFException.\n        final DataInput inData = new DataInputStream(in);","sourceCodeStart":145,"sourceCodeEnd":181,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/org/apache/commons/compress/compressors/gzip/GzipCompressorInputStream.java#L145-L181","documentation":"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.","triggerScenarios":"Reading a multi-member (concatenated) .gz file constructed with decompressConcatenated=false; calling read() after the first member's trailer when trailing bytes exist.","commonSituations":"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.","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."],"exampleFix":"// before\nGzipCompressorInputStream gz = new GzipCompressorInputStream(in);\n// after\nGzipCompressorInputStream gz = new GzipCompressorInputStream(in, true); // concatenated members","handlingStrategy":"validation","validationCode":"boolean concatenated = true; // if input may contain multiple .gz members\nInputStream gz = new GzipCompressorInputStream(rawIn, concatenated);","typeGuard":null,"tryCatchPattern":"try (InputStream gz = new GzipCompressorInputStream(rawIn, true)) {\n    IOUtils.copy(gz, out);\n} catch (IOException e) {\n    if (e.getMessage().contains(\"decompressConcatenated\")) {\n        // reopen with concatenated mode enabled\n    } else {\n        throw e;\n    }\n}","preventionTips":["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."],"tags":["gzip","concatenation","configuration"],"backgroundTag":"invalid-config-value","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}