MuntashirAkon/AppManager · error · BackupException

Couldn't verify misc file.\nFile: ${miscFile}\nFound: ${chec

Error message

Couldn't verify misc file.\nFile: ${miscFile}\nFound: ${checksum}\nRequired: ${mChecksum.get(miscFile.getName())}

What it means

Thrown by loadMiscRules when the misc (permissions) file fails its integrity check: the computed checksum (using the backup's checksum algorithm) does not match the checksum recorded in the backup metadata. This guard only runs when signature checking is not skipped, protecting against a corrupted or tampered misc file.

Source

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

                // downgrading from an Android to another. It's better to simply suppress these
                // exceptions instead of causing a failure or worse, a crash
                Log.e(TAG, e);
            }
        }
    }

    private void loadMiscRules(final PseudoRules rules) throws BackupException {
        Path miscFile;
        try {
            miscFile = mBackupItem.getMiscFile();
        } catch (IOException e) {
            // There are no permissions, just skip
            return;
        }
        if (!mRequestedFlags.skipSignatureCheck()) {
            String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, miscFile);
            if (!checksum.equals(mChecksum.get(miscFile.getName()))) {
                throw new BackupException("Couldn't verify misc file." +
                        "\nFile: " + miscFile +
                        "\nFound: " + checksum +
                        "\nRequired: " + mChecksum.get(miscFile.getName()));
            }
        }
        // Decrypt permission file
        try {
            miscFile = mBackupItem.decrypt(new Path[]{miscFile})[0];
        } catch (IOException | IndexOutOfBoundsException e) {
            throw new BackupException("Failed to decrypt " + miscFile.getName(), e);
        }
        try {
            rules.loadExternalEntries(miscFile);
        } catch (Throwable e) {
            throw new BackupException("Failed to load rules from misc.", e);
        }
    }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Re-copy the original backup from its source so the misc file matches its recorded checksum
  2. Use the restore option to skip signature/checksum verification only if you trust the backup source
  3. Re-create the backup so checksums are regenerated for the current files
  4. Verify disk integrity (bad sectors/SD card corruption) if checksums repeatedly fail

Example fix

// before
new RestoreOp(context, backupItem, new RestoreRequestFlags(/* skipSignatureCheck */ false, ...));
// after
// only skip verification if the backup came from a trusted, checksum-unverifiable source
new RestoreOp(context, backupItem, new RestoreRequestFlags(/* skipSignatureCheck */ true, ...));
Defensive patterns

Strategy: validation

Validate before calling

String expected = metadata.checksums.get(miscFileName);
String actual = DigestUtils.getHexDigest(metadata.checksumAlgo, new File(backupDir, miscFileName));
if (!actual.equals(expected)) throw new IllegalStateException("Backup misc file is corrupt; refusing restore");

Try / catch

try {
    restoreOp.runRestore();
} catch (BackupException e) {
    if (e.getMessage().startsWith("Couldn't verify misc file")) {
        showIntegrityWarningAndOfferSkipSignatureCheck();
    } else throw e;
}

Prevention

When it happens

Trigger: DigestUtils.getHexDigest(checksumAlgo, miscFile) returns a value different from mChecksum.get(miscFile.getName()) — the misc file's content changed after backup creation or the checksum map lacks/corrupts the entry.

Common situations: Backup files edited or re-compressed after creation; partial/corrupted file transfer; restoring a hand-modified misc file; metadata checksums missing because the backup was assembled manually from partial files.

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