{"record":{"id":"69753a4aab623b23","repo":"MuntashirAkon/AppManager","slug":"could-not-get-metadata-file","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/RestoreOp.java","lineNumber":226,"sourceCode":"        if (progressHandler == null) {\n            return;\n        }\n        float current = progressHandler.getLastProgress() + 1;\n        progressHandler.postUpdate(current);\n    }\n\n    public boolean requiresRestart() {\n        return mRequiresRestart;\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":208,"sourceCodeEnd":244,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java#L208-L244","documentation":"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.","triggerScenarios":"getInfoFile() throws IOException during verifyMetadata — typically backup.json missing from the backup directory or an I/O error resolving/reading its path.","commonSituations":"Incomplete backup copy without backup.json yet with other files present; path resolution failure after decryption; file deleted by another process mid-restore.","solutions":["Confirm backup.json exists in the backup directory before starting the restore","Re-copy the full backup directory from the source","Check the backup directory path/permissions passed to RestoreOp","If decrypted on the fly, ensure decryption of info files succeeds"],"exampleFix":"// before\ninfoFile = mBackupItem.getInfoFile();\n// after\ntry {\n    infoFile = mBackupItem.getInfoFile();\n} catch (IOException e) {\n    throw new BackupException(\"Could not get metadata file (backup.json): \" + e.getMessage()\n            + \"; ensure the backup directory is complete.\", e);\n}","handlingStrategy":"validation","validationCode":"if (!new File(backupDir, \"backup.json\").isFile()) {\n    throw new BackupException(\"backup.json required for v5+ signature check is missing\");\n}","typeGuard":"boolean infoFilePresent(Path dir) { return dir.resolve(\"backup.json\").toFile().isFile(); }","tryCatchPattern":"try { restoreOp.runRestore(handler); } catch (BackupException e) { if (\"Could not get metadata file.\".equals(e.getMessage())) { recoverBackupDirectoryOrAbort(); } throw e; }","preventionTips":["Verify backup directory completeness (backup.json + metadata + checksums) before restore","Do not delete 'extra' files from backup folders","Skip signature check only if you accept the integrity risk"],"tags":["file-not-found","metadata","backup","android"],"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-14T16:17:12.679Z"}