{"record":{"id":"9996842d744b2929","repo":"MuntashirAkon/AppManager","slug":"could-not-get-metadata-file-verifyop","errorCode":null,"errorMessage":"Could not get metadata file.","messagePattern":"Could not get metadata file\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java","lineNumber":114,"sourceCode":"            }\n            if (mBackupFlags.backupRules()) {\n                verifyRules();\n            }\n        } catch (BackupException e) {\n            throw e;\n        } catch (Throwable th) {\n            throw new BackupException(\"Unknown error occurred\", th);\n        }\n    }\n\n    private void verifyMetadata() throws BackupException {\n        boolean isV5AndUp = mBackupItem.isV5AndUp();\n        if (isV5AndUp) {\n            Path infoFile;\n            try {\n                infoFile = mBackupItem.getInfoFile();\n            } catch (IOException e) {\n                throw new BackupException(\"Could not get metadata file.\", e);\n            }\n            String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, infoFile);\n            if (!checksum.equals(mChecksum.get(infoFile.getName()))) {\n                throw new BackupException(\"Couldn't verify metadata file.\" +\n                        \"\\nFile: \" + infoFile +\n                        \"\\nFound: \" + checksum +\n                        \"\\nRequired: \" + mChecksum.get(infoFile.getName()));\n            }\n        }\n        Path metadataFile;\n        try {\n            metadataFile = isV5AndUp ? mBackupItem.getMetadataV5File(false) : mBackupItem.getMetadataV2File();\n        } catch (IOException e) {\n            throw new BackupException(\"Could not get metadata file.\", e);\n        }\n        String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, metadataFile);\n        if (!checksum.equals(mChecksum.get(metadataFile.getName()))) {\n            throw new BackupException(\"Couldn't verify metadata file.\" +","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java#L96-L132","documentation":"verifyMetadata() (for v5+ backups) fetches the metadata file path via mBackupItem.getInfoFile(); an IOException there becomes this BackupException. Verification cannot compare the metadata checksum because the metadata file itself cannot be located or opened.","triggerScenarios":"verify() on a v5+ backup where getInfoFile() cannot resolve/open the metadata (info) file — the file is absent from the backup directory, unreadable due to permissions, or the backup item's paths are inconsistent with the on-disk layout.","commonSituations":"Backups copied without the metadata file, renamed backup directories breaking internal path resolution, restricted storage permissions after an Android update, or pre-v5 backup layouts misidentified as v5+.","solutions":["Ensure the metadata/info file exists in the backup directory and re-copy it if missing.","Grant AppManager storage/All-Files-Access permissions so the file can be opened.","Keep the backup directory name and layout exactly as produced by the backup operation.","Confirm the backup is genuinely v5+; verify a pre-v5 backup with a matching AppManager version."],"exampleFix":"// before: metadata file removed during manual cleanup\nbackup/  # info.json deleted\n// after: keep all original backup files intact\nbackup/  # backup.json, info.json, data, checksums","handlingStrategy":"validation","validationCode":"// Check the metadata/info file is present and readable before verify\nFile info = new File(backupDir, \"info.json\"); // per v5+ layout\nif (!info.isFile() || !info.canRead()) throw new IllegalStateException(\"metadata file missing/unreadable\");","typeGuard":null,"tryCatchPattern":"try {\n    new VerifyOp(backupItem).verify();\n} catch (BackupException e) {\n    if (\"Could not get metadata file.\".equals(e.getMessage())) {\n        // restore missing file from source backup or re-grant storage access\n    }\n}","preventionTips":["Keep backup directories byte-identical when moving them (no renaming, no pruning).","Re-check storage permissions after Android upgrades before running verification.","Archive backups as a single archive file to prevent partial copies."],"tags":["metadata","file-not-found","backup-verify","io"],"backgroundTag":"file-not-found","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}