MuntashirAkon/AppManager · error · BackupException
Failed to create checksum file.
Error message
Failed to create checksum file.
What it means
BackupOp wraps any failure while generating and writing the backup checksum file (checksums.txt) in a BackupException with this message, chaining the original cause. The checksum file records digests of all backed-up artifacts (APKs, data, metadata, signing certs) under the metadata's checksum algorithm. Because the checksum is written late in the backup pipeline, this indicates the backup largely succeeded but could not be finalized.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupOp.java:139
PackageManager.GET_META_DATA | GET_SIGNING_CERTIFICATES | PackageManager.GET_PERMISSIONS
| PackageManagerCompat.MATCH_STATIC_SHARED_AND_SDK_LIBRARIES, userId);
Objects.requireNonNull(mPackageInfo);
mApplicationInfo = Objects.requireNonNull(mPackageInfo.applicationInfo);
// Override existing metadata
mMetadata = setupMetadataAndCrypto();
} catch (Throwable e) {
mBackupItem.cleanup();
throw new BackupException("Failed to setup metadata.", e);
}
try {
mChecksum = mBackupItem.getChecksum();
String[] certChecksums = PackageUtils.getSigningCertChecksums(mMetadata.info.checksumAlgo, mPackageInfo, false);
for (int i = 0; i < certChecksums.length; ++i) {
mChecksum.add(CERT_PREFIX + i, certChecksums[i]);
}
} catch (Throwable e) {
mBackupItem.cleanup();
throw new BackupException("Failed to create checksum file.", e);
}
}
@Override
public void close() {
mBackupItem.cleanup();
}
@NonNull
public BackupMetadataV5 getMetadata() {
return mMetadata;
}
void runBackup(@Nullable ProgressHandler progressHandler) throws BackupException {
try {
// Fail backup if the app has items in Android KeyStore and backup isn't enabled
if (mBackupFlags.backupData() && mMetadata.metadata.keyStore && !Prefs.BackupRestore.backupAppsWithKeyStore()) {
throw new BackupException("The app has keystore items and KeyStore backup isn't enabled.");View on GitHub (pinned to 0152f468fc)
Solutions
- Check free space and writability of the backup destination directory.
- Verify the checksum algorithm recorded in backup metadata is one supported by DigestUtils (e.g. MD5, SHA-1, SHA-256).
- Inspect the chained cause ('Caused by') of the BackupException for the real I/O or crypto failure.
- Retry the backup after clearing the incomplete backup directory (BackupOp cleans up via mBackupItem.cleanup()).
Example fix
// before
String[] certChecksums = PackageUtils.getSigningCertChecksums(mMetadata.info.checksumAlgo, mPackageInfo, false);
// after
if (!DigestUtils.isSupportedAlgo(mMetadata.info.checksumAlgo)) {
mMetadata.info.checksumAlgo = "SHA-256";
}
String[] certChecksums = PackageUtils.getSigningCertChecksums(mMetadata.info.checksumAlgo, mPackageInfo, false); Defensive patterns
Strategy: try-catch
Validate before calling
File dest = backupDir; if (!dest.canWrite() || dest.getUsableSpace() < 50*1024*1024) throw new IOException("Destination unwritable or low on space"); Type guard
boolean isSupportedAlgo(String algo) { return algo != null && Arrays.asList("MD5","SHA-1","SHA-256","SHA-512").contains(algo); } Try / catch
try {
new BackupOp(context, packageInfo, flags).runBackup(progress);
} catch (BackupException e) {
Log.e(TAG, "checksum stage failed", e.getCause());
cleanupIncompleteBackup(backupDir);
} Prevention
- Verify destination free space before starting a backup.
- Stick to standard checksum algorithms (SHA-256) in metadata.
- Always read BackupException.getCause() — the message is generic, the cause is specific.
- Let BackupOp.cleanup() remove partial state before retrying.
When it happens
Trigger: An exception (any Throwable) is thrown inside the checksum-building block: PackageUtils.getSigningCertChecksums fails, Checksum add() fails writing to the file, or the checksum file cannot be created/flushed on the backup storage.
Common situations: Storage full or I/O errors on the backup destination (SD card, external storage, SAF-backed path); unsupported or misconfigured checksum algorithm in metadata; failure to compute signing cert checksums for apps with unusual signing schemes.
Understand the failure class
Background: Checksum mismatch errors: "checksum verification failed", "digest mismatch", "expected vs actual checksum" — what they mean and how to fix them — this error's family across 41 libraries.
Related errors
- Failed to create checksum file.
- Could not get backup files.
- Could not retrieve metadata from backup.
- Failed to write metadata.
- Failed to write checksums.txt
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/154896edb8d47e3a.
Report an issue: GitHub.