MuntashirAkon/AppManager · error · BackupException

The app has keystore items and KeyStore backup isn't enabled

Error message

The app has keystore items and KeyStore backup isn't enabled.

What it means

BackupOp deliberately aborts the backup when the target app has entries in the Android KeyStore but the user has not enabled 'backup apps with keystore' in preferences. KeyStore entries cannot be captured in a normal data backup, so proceeding would produce an incomplete/restorable-failing backup. This is a preflight validation failure, not an I/O error.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupOp.java:157

            throw new BackupException("Failed to create checksum file.", e);
        }
    }

    @Override
    public void close() {
        mBackupItem.cleanup();
    }

    @NonNull
    public BackupMetadataV5 getMetadata() {
        return mMetadata;
    }

    void runBackup(@Nullable ProgressHandler progressHandler) throws BackupException {
        try {
            // Fail backup if the app has items in Android KeyStore and backup isn't enabled
            if (mBackupFlags.backupData() && mMetadata.metadata.keyStore && !Prefs.BackupRestore.backupAppsWithKeyStore()) {
                throw new BackupException("The app has keystore items and KeyStore backup isn't enabled.");
            }
            incrementProgress(progressHandler);
            // Backup icon
            backupIcon();
            // Backup source
            if (mBackupFlags.backupApkFiles()) {
                backupApkFiles();
                incrementProgress(progressHandler);
            }
            // Backup data
            if (mBackupFlags.backupData()) {
                backupData();
                // Backup KeyStore
                if (mMetadata.metadata.keyStore) {
                    backupKeyStore();
                }
                incrementProgress(progressHandler);
            }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Enable the 'Backup apps with keystore' option in App Manager's backup/restore settings (Prefs.BackupRestore.backupAppsWithKeyStore).
  2. Run the backup with root access, as keystore backup requires privileged access.
  3. Exclude this app from keystore-flagged batch backups if its KeyStore contents are not needed.
  4. Back up data without the data flag (backup only APK files) to avoid the keystore requirement.

Example fix

// before
BackupFlags flags = new BackupFlags(BackupFlags.BACKUP_DATA);
new BackupOp(context, packageInfo, flags).runBackup(progressHandler);
// after
if (metadata.keyStore && !Prefs.BackupRestore.backupAppsWithKeyStore()) {
    Prefs.BackupRestore.setBackupAppsWithKeyStore(true); // or skip the app
}
new BackupOp(context, packageInfo, flags).runBackup(progressHandler);
Defensive patterns

Strategy: validation

Validate before calling

if (metadata.keyStore && mBackupFlags.backupData() && !Prefs.BackupRestore.backupAppsWithKeyStore()) {
    // enable the setting or skip this app before calling runBackup()
}

Type guard

boolean keystoreBackupAllowed(BackupMetadata meta) { return !meta.keyStore || Prefs.BackupRestore.backupAppsWithKeyStore(); }

Try / catch

try {
    backupOp.runBackup(progress);
} catch (BackupException e) {
    if (e.getMessage().contains("keystore")) { promptUserToEnableKeystoreBackup(); }
}

Prevention

When it happens

Trigger: mBackupFlags.backupData() is requested, metadata.keyStore is true (app stores secrets in Android KeyStore), and Prefs.BackupRestore.backupAppsWithKeyStore() returns false when runBackup() executes.

Common situations: Backing up apps like messengers or authenticators that store keys in the system KeyStore without enabling the keystore-backup setting; running batch backups where most apps don't need the flag but some do.

Related errors


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