MuntashirAkon/AppManager · error · IOException

Unexpected EOF when reading parse information of 1.X PAX…

Error message

Unexpected EOF when reading parse information of 1.X PAX format

What it means

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.

Solutions

  1. Re-download/re-transfer the archive and compare sizes/checksums
  2. Verify the archive was created with a PAX 1.0-conforming tool (GNU tar >= 1.29)
  3. Catch IOException and treat the archive as truncated
  4. Test the archive externally with tar -tvf before processing
Defensive patterns

Strategy: validation

Validate before calling

if (archiveFile.length() < expectedMinimumSize) {
    throw new IOException("Archive too small / truncated");
}

Try / catch

try {
    // read tar
} catch (IOException e) {
    if (e.getMessage().contains("Unexpected EOF when reading parse information")) {
        throw new TruncatedArchiveException("Sparse map truncated", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Incomplete downloads of large sparse archives, interrupted uploads, or streams closed early by upstream failures.

Understand the failure class

Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/55257f417a53df92. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/org/apache/commons/compress/archivers/tar/TarUtils.java:850

    }

    /**
     * For 1.X PAX Format, the sparse headers are stored in the file data block, preceding the actual file data.
     * It consists of a series of decimal numbers delimited by newlines.
     *
     * @param inputStream the input stream of the tar file
     * @return the decimal number delimited by '\n', and the bytes read from input stream
     * @throws IOException
     */
    private static long[] readLineOfNumberForPax1X(final InputStream inputStream) throws IOException {
        int number;
        long result = 0;
        long bytesRead = 0;

        while ((number = inputStream.read()) != '\n') {
            bytesRead += 1;
            if (number == -1) {
                throw new IOException("Unexpected EOF when reading parse information of 1.X PAX format");
            }
            result = result * 10 + (number - '0');
        }
        bytesRead += 1;

        return new long[]{result, bytesRead};
    }

}

View on GitHub (pinned to 0152f468fc)