{"record":{"id":"55257f417a53df92","repo":"MuntashirAkon/AppManager","slug":"unexpected-eof-when-reading-parse-information-of-1-x-pax","errorCode":null,"errorMessage":"Unexpected EOF when reading parse information of 1.X PAX format","messagePattern":"Unexpected EOF when reading parse information of 1\\.X PAX format","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java","lineNumber":850,"sourceCode":"    }\n\n    /**\n     * For 1.X PAX Format, the sparse headers are stored in the file data block, preceding the actual file data.\n     * It consists of a series of decimal numbers delimited by newlines.\n     *\n     * @param inputStream the input stream of the tar file\n     * @return the decimal number delimited by '\\n', and the bytes read from input stream\n     * @throws IOException\n     */\n    private static long[] readLineOfNumberForPax1X(final InputStream inputStream) throws IOException {\n        int number;\n        long result = 0;\n        long bytesRead = 0;\n\n        while ((number = inputStream.read()) != '\\n') {\n            bytesRead += 1;\n            if (number == -1) {\n                throw new IOException(\"Unexpected EOF when reading parse information of 1.X PAX format\");\n            }\n            result = result * 10 + (number - '0');\n        }\n        bytesRead += 1;\n\n        return new long[]{result, bytesRead};\n    }\n\n}","sourceCodeStart":832,"sourceCodeEnd":859,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java#L832-L859","documentation":"Thrown by TarUtils.parseSparse (1.X PAX sparse format parsing) when the stream reaches EOF before the expected newline terminator of a decimal number. Sparse map values in PAX format 1.0 are written as decimal digits followed by LF; EOF means truncated data.","triggerScenarios":"Reading a 1.X PAX sparse archive where the sparse map digits are cut off by end-of-stream; truncated files or reading beyond actual data.","commonSituations":"Incomplete downloads of large sparse archives, interrupted uploads, or streams closed early by upstream failures.","solutions":["Re-download/re-transfer the archive and compare sizes/checksums","Verify the archive was created with a PAX 1.0-conforming tool (GNU tar >= 1.29)","Catch IOException and treat the archive as truncated","Test the archive externally with tar -tvf before processing"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (archiveFile.length() < expectedMinimumSize) {\n    throw new IOException(\"Archive too small / truncated\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    // read tar\n} catch (IOException e) {\n    if (e.getMessage().contains(\"Unexpected EOF when reading parse information\")) {\n        throw new TruncatedArchiveException(\"Sparse map truncated\", e);\n    }\n    throw e;\n}","preventionTips":["Verify archive size and checksum after download","Read the whole stream before closing it","Create PAX 1.0 sparse archives with a current GNU tar"],"tags":["tar","pax-sparse","eof","truncated-stream"],"backgroundTag":"file-read-failed","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"}