MuntashirAkon/AppManager · error · BackupException
APK restore is requested but backup doesn't contain any sour
Error message
APK restore is requested but backup doesn't contain any source files.
What it means
restoreApkFiles() requires that the backup flags recorded in the backup (mBackupFlags) indicate APK/source files were included. If the flags say no source files were backed up, restoring the APK is impossible and this BackupException is thrown. It is a flags-vs-content mismatch: the restore request expects an APK payload the backup never contained.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:276
try {
masterKey = KeyStoreUtils.getMasterKey(mUserId);
} catch (FileNotFoundException e) {
if (oldChecksum == null) return;
else
throw new BackupException("Master key existed when the checksum was made but now it doesn't.");
}
if (oldChecksum == null) {
throw new BackupException("Master key exists but it didn't exist when the backup was made.");
}
String newChecksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, masterKey.getContentAsString().getBytes());
if (!newChecksum.equals(oldChecksum)) {
throw new BackupException("Checksums for master key did not match.");
}
}
private void restoreApkFiles() throws BackupException {
if (!mBackupFlags.backupApkFiles()) {
throw new BackupException("APK restore is requested but backup doesn't contain any source files.");
}
Path[] backupSourceFiles = mBackupItem.getSourceFiles();
if (backupSourceFiles.length == 0) {
// No source backup found
throw new BackupException("Source restore is requested but there are no source files.");
}
boolean isVerified = true;
if (mPackageInfo != null) {
// Check signature of the installed app
List<String> certChecksumList = Arrays.asList(PackageUtils.getSigningCertChecksums(mBackupInfo.checksumAlgo, mPackageInfo, false));
String[] certChecksums = BackupItems.Checksum.getCertChecksums(mChecksum);
for (String checksum : certChecksums) {
if (certChecksumList.contains(checksum)) continue;
isVerified = false;
if (!mRequestedFlags.skipSignatureCheck()) {
throw new BackupException("Signing info verification failed." +
"\nInstalled: " + certChecksumList +
"\nBackup: " + Arrays.toString(certChecksums));View on GitHub (pinned to 0152f468fc)
Solutions
- Re-create the backup with the 'backup APK/source files' option enabled in App Manager before restoring.
- Restore without the APK-restore option and install the app separately (e.g. via Play Store or an APK), then restore data only.
- Check the backup's metadata to confirm which flags were used; if flags were tampered with, fix them or regenerate the checksums.
- Ensure you selected the right backup for this package — a data-only backup may have been picked where an APK backup was expected.
Example fix
// Conceptual: request data-only restore when the backup has no APKs
// before
// restore requested with apk restore -> BackupException
// after
// Check flags in App Manager UI before restoring:
// if (!backupFlags.backupApkFiles()) { installApkManually(); restoreDataOnly(); } Defensive patterns
Strategy: validation
Validate before calling
// Check backup flags before requesting restore:
if (wantApkRestore && !backupFlags.backupApkFiles()) {
// install APK separately or recreate the backup with APK files enabled
} Try / catch
try { restoreOp.runRestore(); } catch (BackupException e) {
if (e.getMessage().contains("backup doesn't contain any source files")) {
// fall back to data-only restore + manual APK install
}
} Prevention
- Enable the APK/source backup option when you may need full reinstalls later.
- Inspect backup metadata flags before planning a restore.
- Keep at least one full (APK + data) backup per important app.
When it happens
Trigger: A restore operation that includes APK restoration reaches restoreApkFiles(), and mBackupFlags.backupApkFiles() returns false — the backup metadata's flags do not mark APK files as backed up.
Common situations: Restoring a data-only backup while expecting the app itself to be reinstalled; the backup was created with APK backup disabled in App Manager's backup options; backup metadata flags were edited or lost so the flag no longer reflects the files present.
Understand the failure class
Background: "--flag is required" and "must specify" CLI errors: how missing-required-flag validation works and how to fix it — this error's family across 20 libraries.
Related errors
- Restore is requested without any flags.
- not found at
- APK files backup is requested but no source directory has be
- Failed to encrypt
- Source restore is requested but there are no source files.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/fb8d05e7e773cc80.
Report an issue: GitHub.