MuntashirAkon/AppManager · error · IOException
Error detected parsing the header
Error message
Error detected parsing the header
What it means
Wraps an IllegalArgumentException raised while constructing a TarArchiveEntry from a raw header block in getNextTarEntry. The header bytes did not satisfy the entry constructor's invariants (e.g. unparseable numeric fields), so the stream converts it into an IOException signaling the archive is broken.
Solutions
- Confirm the stream is a real tar file (check the 'ustar' magic bytes at offset 257 before parsing)
- Wrap the stream in the correct decompressor (GZIPInputStream, XZInputStream...) if the archive is compressed
- Re-download/re-extract the archive and verify its checksum
- Catch IOException and abort with a user-facing 'corrupt archive' message
Example fix
// before
TarArchiveInputStream in = new TarArchiveInputStream(new FileInputStream(f));
// after
try (TarArchiveInputStream in = new TarArchiveInputStream(
new GZIPInputStream(new FileInputStream(f)))) {
// iterate entries
} catch (IOException e) {
throw new IOException("Archive is corrupt or not a valid tar file", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
byte[] magic = new byte[5];
input.mark(262); input.skip(257); input.readNBytes(magic, 0, 5); input.reset();
if (!new String(magic, StandardCharsets.US_ASCII).equals("ustar")) {
throw new IOException("not a tar file");
} Try / catch
try (TarArchiveInputStream in = new TarArchiveInputStream(stream)) {
TarArchiveEntry e;
while ((e = in.getNextTarEntry()) != null) { ... }
} catch (IOException e) {
throw new IOException("Corrupt or non-tar archive", e);
} Prevention
- Check the ustar magic bytes before trusting a file as tar
- Wrap compressed streams in the right decompressor first
- Validate downloads against known hashes
When it happens
Trigger: getNextTarEntry() (via getNextEntry()) hits a header block whose name, mode, uid/gid, size, or mtime fields cannot be parsed — e.g. NUL-filled or random bytes where a valid octal field is expected.
Common situations: Reading a partially downloaded archive; parsing a file that is not a tar (e.g. a gzip file not wrapped in GZIPInputStream); archives written by non-compliant tools.
Related errors
- broken archive, entry with negative size
- Paxheader value size
- APK files backup is requested but no APK files have been…
- Backup failed for
- Backup failed for
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/28af1c39ebe833a8.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java:368
/* Skip will only go to the end of the current entry */
IOUtils.skip(this, Long.MAX_VALUE);
/* skip to the end of the last record */
skipRecordPadding();
}
final byte[] headerBuf = getRecord();
if (headerBuf == null) {
/* hit EOF */
currEntry = null;
return null;
}
try {
currEntry = new TarArchiveEntry(headerBuf, zipEncoding, lenient);
} catch (final IllegalArgumentException e) {
throw new IOException("Error detected parsing the header", e);
}
entryOffset = 0;
entrySize = currEntry.getSize();
if (currEntry.isGNULongLinkEntry()) {
final byte[] longLinkData = getLongNameData();
if (longLinkData == null) {
// Bugzilla: 40334
// Malformed tar file - long link entry name not followed by
// entry
return null;
}
currEntry.setLinkName(zipEncoding.decode(longLinkData));
}
if (currEntry.isGNULongNameEntry()) {
final byte[] longNameData = getLongNameData();View on GitHub (pinned to 0152f468fc)