{"record":{"id":"bcb129bf36487bce","repo":"MuntashirAkon/AppManager","slug":"invalid-source-compression-type","errorCode":null,"errorMessage":"Invalid source compression type: ","messagePattern":"Invalid source compression type: ","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java","lineNumber":199,"sourceCode":"    public void cleanup() {\n        for (Path file : mFilesToBeDeleted) {\n            file.delete();\n        }\n    }\n\n    private void backupApkFile() throws BackupException {\n        // Decompress APK file\n        Path baseApkFile = FileUtils.getTempPath(mPackageName, mDestMetadata.metadata.apkName);\n        try (InputStream pis = getApkFile(mSourceMetadata.apkName, mSourceMetadata.tarType).openInputStream();\n             BufferedInputStream bis = new BufferedInputStream(pis)) {\n            CompressorInputStream is;\n            if (TAR_GZIP.equals(mSourceMetadata.tarType)) {\n                is = new GzipCompressorInputStream(bis, true);\n            } else if (TAR_BZIP2.equals(mSourceMetadata.tarType)) {\n                is = new BZip2CompressorInputStream(bis, true);\n            } else {\n                baseApkFile.requireParent().delete();\n                throw new BackupException(\"Invalid source compression type: \" + mSourceMetadata.tarType);\n            }\n            try (OutputStream fos = baseApkFile.openOutputStream()) {\n                // The whole file is the APK\n                IoUtils.copy(is, fos);\n            } finally {\n                is.close();\n            }\n        } catch (IOException e) {\n            baseApkFile.requireParent().delete();\n            throw new BackupException(\"Couldn't decompress \" + mSourceMetadata.apkName, e);\n        }\n        // Get certificate checksums\n        try {\n            String[] checksums = ConvertUtils.getChecksumsFromApk(baseApkFile, mDestMetadata.info.checksumAlgo);\n            for (int i = 0; i < checksums.length; ++i) {\n                mChecksum.add(CERT_PREFIX + i, checksums[i]);\n            }\n        } catch (Exception ignore) {","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/TBConverter.java#L181-L217","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\n} else {\n    baseApkFile.requireParent().delete();\n    throw new BackupException(\"Invalid source compression type: \" + mSourceMetadata.tarType);\n}\n// after\n} else if (TAR.equals(mSourceMetadata.tarType)) {\n    is = new TarArchiveInputStream(bis);\n} else {\n    baseApkFile.requireParent().delete();\n    throw new BackupException(\"Invalid source compression type: \" + mSourceMetadata.tarType);\n}","handlingStrategy":"validation","validationCode":"String t = sourceMetadata.tarType;\nif (!\"TAR_GZIP\".equals(t) && !\"TAR_BZIP2\".equals(t)) {\n    throw new IllegalArgumentException(\"Converter supports TAR_GZIP/TAR_BZIP2 only, got: \" + t);\n}","typeGuard":"fun String?.isSupportedCompression(): Boolean =\n    this != null && (equals(\"TAR_GZIP\") || equals(\"TAR_BZIP2\"))","tryCatchPattern":"try {\n    converter.convert();\n} catch (BackupException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Invalid source compression type\")) {\n        // offer recompressing the source archive to gzip or switching converter mode\n    }\n}","preventionTips":["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."],"tags":["compression","unsupported-value","tar"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}