MuntashirAkon/AppManager · error · BackupException

Failed to write checksums.txt

Error message

Failed to write checksums.txt

What it means

After closing the checksum writer, BackupOp encrypts checksums.txt when encryption is enabled; an IOException from mBackupItem.encrypt() is wrapped in this BackupException. The checksum file exists but could not be encrypted into the final backup, so the backup set is incomplete and not committed.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupOp.java:200

            if (mMetadata.metadata.hasRules) {
                backupRules();
                incrementProgress(progressHandler);
            }
            // Write modified metadata
            try {
                Map<String, String> filenameChecksumMap = MetadataManager.writeMetadata(mMetadata, mBackupItem);
                for (Map.Entry<String, String> entry : filenameChecksumMap.entrySet()) {
                    mChecksum.add(entry.getKey(), entry.getValue());
                }
            } catch (IOException e) {
                throw new BackupException("Failed to write metadata.", e);
            }
            mChecksum.close();
            // Encrypt checksum
            try {
                mBackupItem.encrypt(new Path[]{mChecksum.getFile()});
            } catch (IOException e) {
                throw new BackupException("Failed to write checksums.txt", e);
            }
            // Replace current backup
            try {
                mBackupItem.commit();
            } catch (IOException e) {
                throw new BackupException("Could not finalise backup.", e);
            }
        } catch (BackupException e) {
            throw e;
        } catch (Throwable th) {
            throw new BackupException("Unknown error occurred.", th);
        }
    }

    private static void incrementProgress(@Nullable ProgressHandler progressHandler) {
        if (progressHandler == null) {
            return;
        }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Verify the backup encryption password/keystore is correct and crypto providers are available (crypto needs root).
  2. Check free space on the destination.
  3. Inspect the chained IOException for the underlying crypto/I/O cause.
  4. Retry the backup; the old backup is not committed so no corruption occurs.

Example fix

// before
CryptoUtils.setupPassword(Prefs.EncryptionMode.DEFAULT, password); // wrong/mistyped password
// after
byte[] keystore = CryptoUtils.getKeystore(CryptoUtils.KeyStoreMode.RAW); // verify crypto is available
CryptoUtils.setupPassword(Prefs.EncryptionMode.DEFAULT, verifiedPassword);
Defensive patterns

Strategy: try-catch

Validate before calling

if (Prefs.Crypto.isEncryptionEnabled()) { /* verify password works before running backup */ CryptoUtils.decryptTestBlob(savedBlob, password); }

Type guard

boolean encryptionReady() { return !Prefs.Crypto.isEncryptionEnabled() || CryptoUtils.canAccessKeystore(); }

Try / catch

try {
    backupOp.runBackup(progress);
} catch (BackupException e) {
    if (e.getMessage().equals("Failed to write checksums.txt")) {
        Log.e(TAG, "checksum encryption failed", (IOException) e.getCause());
    }
}

Prevention

When it happens

Trigger: Encryption is enabled for the backup and mBackupItem.encrypt(new Path[]{mChecksum.getFile()}) throws IOException — bad crypto setup, missing output stream, or storage failure.

Common situations: Wrong/changed backup encryption password or keystore; encrypted-backup prerequisites (root, crypto provider) unavailable; destination storage full while writing the encrypted copy.

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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