MuntashirAkon/AppManager · error · BackupException

Invalid compression type: ${tarType}

Error message

Invalid compression type: ${tarType}

What it means

During backupData() decompression of the source archive, TBConverter only supports TAR_GZIP and TAR_BZIP2 tar types for the source metadata. If mSourceMetadata.tarType is anything else (note the message string interpolates the unrelated local variable tarType), it throws BackupException. This guards against silently feeding unsupported archive codecs into Gzip/BZip2 compressor streams.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java:266

        }
        String tarType = mDestMetadata.info.tarType;
        int i = 0;
        String intBackupFilePrefix = null;
        String extBackupFilePrefix = null;
        if (mDestMetadata.info.flags.backupInternalData()) {
            intBackupFilePrefix = BackupUtils.getDataFilePrefix(i++, getExt(tarType));
        }
        if (mDestMetadata.info.flags.backupExternalData()) {
            extBackupFilePrefix = BackupUtils.getDataFilePrefix(i, getExt(tarType));
        }
        try (BufferedInputStream bis = new BufferedInputStream(dataFile.openInputStream())) {
            CompressorInputStream cis;
            if (TAR_GZIP.equals(mSourceMetadata.tarType)) {
                cis = new GzipCompressorInputStream(bis);
            } else if (TAR_BZIP2.equals(mSourceMetadata.tarType)) {
                cis = new BZip2CompressorInputStream(bis);
            } else {
                throw new BackupException("Invalid compression type: " + tarType);
            }
            TarArchiveInputStream tis = new TarArchiveInputStream(cis);
            SplitOutputStream intSos = null, extSos = null;
            TarArchiveOutputStream intTos = null, extTos = null;
            if (intBackupFilePrefix != null) {
                intSos = new SplitOutputStream(mBackupItem.getUnencryptedBackupPath(), intBackupFilePrefix, DEFAULT_SPLIT_SIZE);
                BufferedOutputStream bos = new BufferedOutputStream(intSos);
                OutputStream cos = TarUtils.createCompressedStream(bos, tarType);
                intTos = new TarArchiveOutputStream(cos);
                intTos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);
                intTos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
            }
            if (extBackupFilePrefix != null) {
                extSos = new SplitOutputStream(mBackupItem.getUnencryptedBackupPath(), extBackupFilePrefix, DEFAULT_SPLIT_SIZE);
                BufferedOutputStream bos = new BufferedOutputStream(extSos);
                OutputStream cos = TarUtils.createCompressedStream(bos, tarType);
                extTos = new TarArchiveOutputStream(cos);
                extTos.setLongFileMode(TarArchiveOutputStream.LONGFILE_POSIX);

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Recompress or re-create the source backup with GZIP or BZIP2 compression.
  2. Inspect the prop file's app_apk_codec value and change it to GZIP or BZIP2 only if the data really is in that format.
  3. Check that the source metadata was parsed correctly (readPropFile maps GZIP/BZIP2 only); a corrupted/misread prop can leave tarType wrong.
  4. Convert via a third format supported by both tools if the codec cannot be changed.

Example fix

// before
String codec = "ZSTD"; // from prop
// after
if (!"GZIP".equals(codec) && !"BZIP2".equals(codec)) {
    // repack archive with gzip first
    codec = "GZIP";
}
Defensive patterns

Strategy: validation

Validate before calling

String codec = readPropCodec(propFile); // app_apk_codec
if (!"GZIP".equals(codec) && !"BZIP2".equals(codec)) {
    throw new IllegalStateException("Codec not convertible: " + codec);
}

Try / catch

try {
    converter.convert(backupDir);
} catch (BackupException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Invalid compression type")) {
        // repack archive with gzip and retry
    } else throw e;
}

Prevention

When it happens

Trigger: Converting a backup whose prop file declares a compression codec other than GZIP or BZIP2 (e.g. a plain/none or ZSTD/lz4-style codec), so neither TAR_GZIP.equals(...) nor TAR_BZIP2.equals(...) matches.

Common situations: Older or newer OAndBackup versions writing codecs App Manager's TB format does not support; prop files edited by hand; backups produced with different compression settings than the two supported ones.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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