MuntashirAkon/AppManager · error · BackupException

Couldn't verify metadata file.\nFile: " + metadataFile + "\n

Error message

Couldn't verify metadata file.\nFile: " + metadataFile + "\nFound: " + checksum + "\nRequired: " + mChecksum.get(metadataFile.getName())

What it means

verifyMetadata() recomputes the digest of the metadata file (v5 metadata or v2 metadata depending on backup format) and it does not match the digest stored in the backup's checksum file. The metadata content differs from what was recorded at backup time, so App Manager refuses to trust it.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java:132

                throw new BackupException("Could not get metadata file.", e);
            }
            String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, infoFile);
            if (!checksum.equals(mChecksum.get(infoFile.getName()))) {
                throw new BackupException("Couldn't verify metadata file." +
                        "\nFile: " + infoFile +
                        "\nFound: " + checksum +
                        "\nRequired: " + mChecksum.get(infoFile.getName()));
            }
        }
        Path metadataFile;
        try {
            metadataFile = isV5AndUp ? mBackupItem.getMetadataV5File(false) : mBackupItem.getMetadataV2File();
        } catch (IOException e) {
            throw new BackupException("Could not get metadata file.", e);
        }
        String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, metadataFile);
        if (!checksum.equals(mChecksum.get(metadataFile.getName()))) {
            throw new BackupException("Couldn't verify metadata file." +
                    "\nFile: " + metadataFile +
                    "\nFound: " + checksum +
                    "\nRequired: " + mChecksum.get(metadataFile.getName()));
        }
    }

    private void verifyApkFiles() throws BackupException {
        Path[] backupSourceFiles = mBackupItem.getSourceFiles();
        if (backupSourceFiles.length == 0) {
            // No APK files found
            throw new BackupException("Backup does not contain any APK files.");
        }
        String checksum;
        for (Path file : backupSourceFiles) {
            checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);
            if (!checksum.equals(mChecksum.get(file.getName()))) {
                throw new BackupException("Could not verify APK files." +
                        "\nFile: " + file.getName() +

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Compare the 'Found' and 'Required' digests in the message against the file to confirm which one is stale; recompute with the recorded algo (sha256sum etc.).
  2. Restore the original, unmodified metadata file (re-copy the backup from its source).
  3. If the edit was intentional, recompute the metadata digest and update the checksum file entry.
  4. Recreate the backup if the original is unavailable.

Example fix

// before
//   Couldn't verify metadata file. Found: abc123... Required: def456...
// after: regenerate the checksum file entry for the (edited) metadata file
// $ sha256sum <metadata-file>  -> update entry in backup.checksums
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check metadata integrity outside the library
Path metadataFile = isV5AndUp ? backupItem.getMetadataV5File(false) : backupItem.getMetadataV2File();
String found = DigestUtils.getHexDigest(backupInfo.checksumAlgo, metadataFile);
if (!found.equals(checksums.get(metadataFile.getName()))) {
    throw new IllegalStateException("metadata checksum mismatch: re-copy or regenerate checksums");
}

Try / catch

try {
    new VerifyOp(backupItem);
} catch (BackupException e) {
    if (e.getMessage().startsWith("Couldn't verify metadata file")) {
        // compare Found vs Required; restore original metadata or update checksum entry
    }
}

Prevention

When it happens

Trigger: VerifyOp constructor -> verifyMetadata(); DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, metadataFile) != mChecksum.get(metadataFile.getName()), including when the checksum file lacks an entry for the metadata file name (null required value).

Common situations: Metadata file edited manually (e.g. changing versionName or flags) without updating checksums; partial download/transfer that altered the file; a checksum file from a different backup paired with this metadata; checksumAlgo mismatch between what was recorded and how the file is hashed.

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


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