MuntashirAkon/AppManager · error · BackupException

Failed to encrypt checksums.txt

Error message

Failed to encrypt checksums.txt

What it means

As the last content step, the converter encrypts checksums.txt via mBackupItem.encrypt(new Path[]{mChecksum.getFile()}). An IOException during encryption becomes BackupException("Failed to encrypt checksums.txt").

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/convert/OABConverter.java:153

            if (mDestMetadata.info.flags.backupData()) {
                backupData();
            }
            // Write modified metadata
            try {
                Map<String, String> filenameChecksumMap = MetadataManager.writeMetadata(mDestMetadata, mBackupItem);
                for (Map.Entry<String, String> filenameChecksumPair : filenameChecksumMap.entrySet()) {
                    mChecksum.add(filenameChecksumPair.getKey(), filenameChecksumPair.getValue());
                }
            } catch (IOException e) {
                throw new BackupException("Failed to write metadata.", e);
            }
            // Store checksum for metadata
            mChecksum.close();
            // Encrypt checksum
            try {
                mBackupItem.encrypt(new Path[]{mChecksum.getFile()});
            } catch (IOException e) {
                throw new BackupException("Failed to encrypt checksums.txt", e);
            }
            // Replace current backup
            try {
                mBackupItem.commit();
            } catch (IOException e) {
                throw new BackupException("Could not finalise backup.", e);
            }
            backupSuccess = true;
        } catch (BackupException e) {
            throw e;
        } catch (Throwable th) {
            throw new BackupException("Unknown error occurred.", th);
        } finally {
            mBackupItem.cleanup();
            if (backupSuccess) {
                BackupUtils.putBackupToDbAndBroadcast(ContextUtils.getContext(), mDestMetadata);
            }
        }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Verify encryption keys/configuration match metadata.info.crypto
  2. Ensure enough free space for the encrypted copy of checksums.txt
  3. Check the wrapped IOException cause for the root failure
  4. Disable encryption (crypto = null) if encrypted backups are not required
Defensive patterns

Strategy: try-catch

Validate before calling

if (metadata.crypto != null && !isCryptoConfigured(metadata.crypto)) {
    throw new IllegalStateException("Encryption keys unavailable for " + metadata.crypto);
}

Try / catch

try {
    converter.convert();
} catch (BackupException e) {
    if ("Failed to encrypt checksums.txt".equals(e.getMessage())) {
        // fix crypto config or disable encryption, then retry
    }
}

Prevention

When it happens

Trigger: BackupItem.encrypt() fails on the checksum file — crypto stream setup failure, missing encryption key, or I/O error writing the encrypted output.

Common situations: Encrypted backup mode selected but keys misconfigured; storage full when writing encrypted copy; crypto scheme mismatch between metadata and configured keys.

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/c2e8427d0f8e0430. Report an issue: GitHub.