MuntashirAkon/AppManager · error · BackupException

Couldn't verify metadata file.

Error message

Couldn't verify metadata file.

What it means

verifyMetadata digests backup.json with mBackupInfo.checksumAlgo and compares it to the recorded checksum; on mismatch it throws BackupException 'Couldn't verify metadata file.' with file, found, and required values. This means the backup info file changed after the backup was signed/recorded.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:230

        progressHandler.postUpdate(current);
    }

    public boolean requiresRestart() {
        return mRequiresRestart;
    }

    private void verifyMetadata() throws BackupException {
        boolean isV5AndUp = mBackupItem.isV5AndUp();
        if (isV5AndUp) {
            Path infoFile;
            try {
                infoFile = mBackupItem.getInfoFile();
            } catch (IOException e) {
                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()));
        }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Restore the original unmodified backup.json that matches checksums.txt
  2. If you must change backup.json, re-create the backup (or recompute checksums) so the manifest matches
  3. Compare the 'Found' vs 'Required' digests in the message to confirm the file really differs
  4. Verify mBackupInfo.checksumAlgo matches the algorithm used to generate the manifest

Example fix

// before
if (!checksum.equals(mChecksum.get(infoFile.getName()))) {
    throw new BackupException("Couldn't verify metadata file.\nFile: " + infoFile + ...);
}
// after
// no code fix: restore pristine backup.json, or regenerate the checksum manifest
// e.g. recompute: checksums.txt entry for backup.json = digester(infoFile)
Defensive patterns

Strategy: validation

Validate before calling

// pre-check: recompute digest of backup.json and compare with the manifest entry
String found = DigestUtils.getHexDigest(info.checksumAlgo, infoFile);
if (!found.equals(checksums.get(infoFile.getName()))) throw new BackupException("backup.json was modified after backup");

Try / catch

try { restoreOp.runRestore(handler); } catch (BackupException e) { if (e.getMessage().startsWith("Couldn't verify metadata file.")) { showFoundVsRequiredDialog(e.getMessage()); } throw e; }

Prevention

When it happens

Trigger: DigestUtils.getHexDigest(infoFile) != mChecksum.get(infoFile.getName()) — backup.json was modified, re-encoded, or truncated after checksums were computed, or the wrong checksum algo is recorded in backup.json.

Common situations: User hand-edited backup.json (e.g. changed label or flags) before restoring; transfer mangled the file (line-ending or encoding changes); backup created by an older app version using a different algorithm.

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