{"record":{"id":"68388f52affbfb29","repo":"MuntashirAkon/AppManager","slug":"failed-to-get-checksums","errorCode":null,"errorMessage":"Failed to get checksums.","messagePattern":"Failed to get checksums\\.","errorType":"exception","errorClass":"BackupException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java","lineNumber":141,"sourceCode":"        }\n        try {\n            mBackupItem.setCrypto(mBackupInfo.getCrypto());\n        } catch (CryptoException e) {\n            mBackupItem.cleanup();\n            throw new BackupException(\"Could not get crypto \" + mBackupInfo.crypto, e);\n        }\n        try {\n            mBackupMetadata = mBackupItem.getMetadata(mBackupInfo).metadata;\n        } catch (IOException e) {\n            mBackupItem.cleanup();\n            throw new BackupException(\"Could not read backup metadata. Possibly due to a malformed json file.\", e);\n        }\n        // Get checksums\n        try {\n            mChecksum = mBackupItem.getChecksum();\n        } catch (Throwable e) {\n            mBackupItem.cleanup();\n            throw new BackupException(\"Failed to get checksums.\", e);\n        }\n        // Verify metadata\n        if (!requestedFlags.skipSignatureCheck()) {\n            try {\n                verifyMetadata();\n            } catch (BackupException e) {\n                mBackupItem.cleanup();\n                throw e;\n            }\n        }\n        // Check user handle\n        if (mBackupInfo.userId != userId) {\n            Log.w(TAG, \"Using different user handle.\");\n        }\n        // Get package info\n        mPackageInfo = null;\n        try {\n            mPackageInfo = PackageManagerCompat.getPackageInfo(packageName, GET_SIGNING_CERTIFICATES","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java#L123-L159","documentation":"RestoreOp loads the checksum manifest with mBackupItem.getChecksum() and wraps any Throwable as BackupException 'Failed to get checksums.' Checksums are required before metadata verification, so the restore aborts and the backup item is cleaned up.","triggerScenarios":"getChecksum() throws because checksums.txt (or the v5 equivalent) is missing, unreadable, or its lines are malformed; any Throwable is caught, including RuntimeExceptions from parsing.","commonSituations":"Backup folder copied without checksums file; checksum file truncated by interrupted transfer; empty checksum file for backups created without checksum checking but the restore path still demands it.","solutions":["Ensure the checksum file from the original backup is present and complete in the backup directory","Re-copy the entire backup folder in one operation and compare sizes/checksums of the manifest itself","If the backup intentionally has no checksums, re-create the backup with checksum verification enabled","Inspect the wrapped Throwable to identify parse vs I/O errors"],"exampleFix":"// before\ntry {\n    mChecksum = mBackupItem.getChecksum();\n} catch (Throwable e) {\n    mBackupItem.cleanup();\n    throw new BackupException(\"Failed to get checksums.\", e);\n}\n// after\nFile checksumFile = new File(backupDir, \"checksums.txt\");\nif (!checksumFile.exists()) {\n    throw new BackupException(\"checksums.txt missing from backup directory \" + backupDir);\n}\ntry {\n    mChecksum = mBackupItem.getChecksum();\n} catch (Throwable e) {\n    mBackupItem.cleanup();\n    throw new BackupException(\"Failed to get checksums.\", e);\n}","handlingStrategy":"validation","validationCode":"File cs = new File(backupDir, \"checksums.txt\");\nif (!cs.isFile() || cs.length() == 0) throw new BackupException(\"Checksum manifest missing/empty in \" + backupDir);","typeGuard":null,"tryCatchPattern":"try { restoreOp.runRestore(progressHandler); } catch (BackupException e) { if (\"Failed to get checksums.\".equals(e.getMessage())) { recopyBackupOrSkipIntegrityCheck(); } throw e; }","preventionTips":["Always create backups with checksum verification enabled","Verify the backup directory contains checksums.txt immediately after transfer","Re-copy rather than partially syncing backup folders"],"tags":["checksum","backup","restore","android"],"backgroundTag":"checksum-mismatch","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"}