MuntashirAkon/AppManager · error · BackupException

Could not get metadata file.

Error message

Could not get metadata file.

What it means

verifyMetadata computes a digest of backup.json (the 'info' file) for v5+ backups and needs its path from mBackupItem.getInfoFile(); an IOException there is wrapped as BackupException 'Could not get metadata file.' Verification aborts before any checksum comparison.

Solutions

  1. Confirm backup.json exists in the backup directory before starting the restore
  2. Re-copy the full backup directory from the source
  3. Check the backup directory path/permissions passed to RestoreOp
  4. If decrypted on the fly, ensure decryption of info files succeeds

Example fix

// before
infoFile = mBackupItem.getInfoFile();
// after
try {
    infoFile = mBackupItem.getInfoFile();
} catch (IOException e) {
    throw new BackupException("Could not get metadata file (backup.json): " + e.getMessage()
            + "; ensure the backup directory is complete.", e);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!new File(backupDir, "backup.json").isFile()) {
    throw new BackupException("backup.json required for v5+ signature check is missing");
}

Type guard

boolean infoFilePresent(Path dir) { return dir.resolve("backup.json").toFile().isFile(); }

Try / catch

try { restoreOp.runRestore(handler); } catch (BackupException e) { if ("Could not get metadata file.".equals(e.getMessage())) { recoverBackupDirectoryOrAbort(); } throw e; }

Prevention

When it happens

Trigger: getInfoFile() throws IOException during verifyMetadata — typically backup.json missing from the backup directory or an I/O error resolving/reading its path.

Common situations: Incomplete backup copy without backup.json yet with other files present; path resolution failure after decryption; file deleted by another process mid-restore.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


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

Appendix: source

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

        if (progressHandler == null) {
            return;
        }
        float current = progressHandler.getLastProgress() + 1;
        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." +

View on GitHub (pinned to 0152f468fc)