MuntashirAkon/AppManager · error · BackupException
Invalid source compression type:
Error message
Invalid source compression type:
What it means
backupApkFile() decompresses the source APK archive based on the source metadata's tarType (TAR_GZIP or TAR_BZIP2). If the tarType matches neither, it deletes the staging directory and throws this BackupException. It means the source backup uses a compression scheme the converter doesn't handle.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java:199
public void cleanup() {
for (Path file : mFilesToBeDeleted) {
file.delete();
}
}
private void backupApkFile() throws BackupException {
// Decompress APK file
Path baseApkFile = FileUtils.getTempPath(mPackageName, mDestMetadata.metadata.apkName);
try (InputStream pis = getApkFile(mSourceMetadata.apkName, mSourceMetadata.tarType).openInputStream();
BufferedInputStream bis = new BufferedInputStream(pis)) {
CompressorInputStream is;
if (TAR_GZIP.equals(mSourceMetadata.tarType)) {
is = new GzipCompressorInputStream(bis, true);
} else if (TAR_BZIP2.equals(mSourceMetadata.tarType)) {
is = new BZip2CompressorInputStream(bis, true);
} else {
baseApkFile.requireParent().delete();
throw new BackupException("Invalid source compression type: " + mSourceMetadata.tarType);
}
try (OutputStream fos = baseApkFile.openOutputStream()) {
// The whole file is the APK
IoUtils.copy(is, fos);
} finally {
is.close();
}
} catch (IOException e) {
baseApkFile.requireParent().delete();
throw new BackupException("Couldn't decompress " + mSourceMetadata.apkName, e);
}
// Get certificate checksums
try {
String[] checksums = ConvertUtils.getChecksumsFromApk(baseApkFile, mDestMetadata.info.checksumAlgo);
for (int i = 0; i < checksums.length; ++i) {
mChecksum.add(CERT_PREFIX + i, checksums[i]);
}
} catch (Exception ignore) {View on GitHub (pinned to 0152f468fc)
Solutions
- Check mSourceMetadata.tarType before converting; add a branch (e.g. new TarArchiveInputStream without compressor) if uncompressed TAR is expected.
- Recreate the source backup using GZIP or BZIP2 compression.
- Upgrade the converter/library to a version supporting the source compression type.
- Fix corrupted metadata so tarType reflects the actual archive compression.
Example fix
// before
} else {
baseApkFile.requireParent().delete();
throw new BackupException("Invalid source compression type: " + mSourceMetadata.tarType);
}
// after
} else if (TAR.equals(mSourceMetadata.tarType)) {
is = new TarArchiveInputStream(bis);
} else {
baseApkFile.requireParent().delete();
throw new BackupException("Invalid source compression type: " + mSourceMetadata.tarType);
} Defensive patterns
Strategy: validation
Validate before calling
String t = sourceMetadata.tarType;
if (!"TAR_GZIP".equals(t) && !"TAR_BZIP2".equals(t)) {
throw new IllegalArgumentException("Converter supports TAR_GZIP/TAR_BZIP2 only, got: " + t);
} Type guard
fun String?.isSupportedCompression(): Boolean =
this != null && (equals("TAR_GZIP") || equals("TAR_BZIP2")) Try / catch
try {
converter.convert();
} catch (BackupException e) {
if (e.getMessage() != null && e.getMessage().startsWith("Invalid source compression type")) {
// offer recompressing the source archive to gzip or switching converter mode
}
} Prevention
- Check the source backup's tarType field before conversion and reject unsupported values early.
- Create source backups with GZIP or BZIP2 compression when the target converter is TBConverter.
- Handle uncompressed TAR explicitly if your source format can be TAR-only.
When it happens
Trigger: mSourceMetadata.tarType is neither TAR_GZIP nor TAR_BZIP2 when extracting the APK file — e.g. tarType is TAR (no compression), TAR_XZ, TAR_LZMA, TAR_ZSTD, or an unknown/corrupted value.
Common situations: Converting backups created with different compression settings (e.g. uncompressed TAR or zstd backups from newer versions) that this converter doesn't support; corrupted source metadata where tarType was lost.
Related errors
- APK files backup is requested but no source directory has be
- Failed to backup data directory at
- Could not backup KeyStore item.
- Failed to extract the apk file(s).
- Failed to restore data files for index ${index}.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/bcb129bf36487bce.
Report an issue: GitHub.