MuntashirAkon/AppManager · error · BackupException

Source restore is requested but there are no source files.

Error message

Source restore is requested but there are no source files.

What it means

After confirming APK restore was requested, restoreApkFiles() fetches the actual source (APK) files from the backup via mBackupItem.getSourceFiles(). If the returned array is empty, the backup directory contains no source archive despite the flags claiming APK backup, and this BackupException is thrown — the backup set is incomplete.

Source

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

                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));
                }
            }
        }
        if (!mRequestedFlags.skipSignatureCheck()) {
            String checksum;

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Check the backup directory for the source archive file; if missing, re-copy the complete backup set from its origin.
  2. Re-create the backup, ensuring the backup completes without interruption before restoring.
  3. Restore without APK restore enabled and install the app from another source if only data can be restored.
  4. Verify storage access/mount: sometimes the file exists but the backup path is wrong or not fully mounted, making getSourceFiles() see nothing.
Defensive patterns

Strategy: validation

Validate before calling

// Confirm source files exist before restore:
Path[] sources = backupItem.getSourceFiles();
if (sources.length == 0) {
    // backup incomplete: re-copy full backup set before invoking restore
}

Try / catch

try { restoreOp.runRestore(); } catch (BackupException e) {
    if (e.getMessage().contains("there are no source files")) {
        // prompt user to restore the missing source archive or skip APK restore
    }
}

Prevention

When it happens

Trigger: mBackupFlags.backupApkFiles() is true but mBackupItem.getSourceFiles() returns a zero-length array during a restore.

Common situations: The source.tar(.gz) file was deleted or lost while copying/backing up the backup folder; an interrupted backup wrote flags/metadata but failed to write the source archive; partial backup restore from cloud storage where large files were skipped.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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