MuntashirAkon/AppManager · error · IllegalArgumentException

Backup with name ${mBackupNames[i]} doesn't exist.

Error message

Backup with name ${mBackupNames[i]} doesn't exist.

What it means

getDeleteOpOptions() resolves each entry of mBackupNames to a latest Backup record via BackupUtils.retrieveLatestBackupFromDb(userId, name, packageName); a null result for any index throws IllegalArgumentException naming that backup. It means at least one requested backup does not exist in the database, so its relative directory cannot be determined for deletion.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/batchops/struct/BatchBackupOptions.java:92

    }

    public DeleteOpOptions getDeleteOpOptions(@NonNull String packageName, @UserIdInt int userId) {
        // For delete operation, backup names (v4) and relative dirs are only set for single
        // package backups. In all other cases, it only uses base backups.
        String[] relativeDirs;
        if (mRelativeDirs != null) {
            relativeDirs = mRelativeDirs;
        } else {
            if (mBackupNames == null || mBackupNames.length == 0) {
                // Base backup
                relativeDirs = null;
            } else {
                // Generate relative directories
                relativeDirs = new String[mBackupNames.length];
                for (int i = 0; i < relativeDirs.length; ++i) {
                    Backup backup = BackupUtils.retrieveLatestBackupFromDb(userId, mBackupNames[i], packageName);
                    if (backup == null) {
                        throw new IllegalArgumentException("Backup with name " + mBackupNames[i] + " doesn't exist.");
                    }
                    relativeDirs[i] = backup.relativeDir;
                }
            }
        }
        return new DeleteOpOptions(packageName, userId, relativeDirs);
    }

    protected BatchBackupOptions(@NonNull Parcel in) {
        mFlags = in.readInt();
        mBackupNames = in.createStringArray();
        mRelativeDirs = in.createStringArray();
    }

    public static final Creator<BatchBackupOptions> CREATOR = new Creator<BatchBackupOptions>() {
        @Override
        @NonNull
        public BatchBackupOptions createFromParcel(@NonNull Parcel in) {

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Filter mBackupNames to only names present in the backup DB before calling deleteBackups.
  2. Skip or correct the specific missing name reported in the message and retry the rest.
  3. Verify userId matches the backups' owner user.
  4. Re-sync the backup database if the backups exist on disk but are absent from the DB.

Example fix

// before
new BatchBackupOptions(null, new String[]{"a", "b", "c"}).getDeleteOpOptions(pkg, userId);
// after
String[] valid = Arrays.stream(names)
    .filter(n -> BackupUtils.retrieveLatestBackupFromDb(userId, n, pkg) != null)
    .toArray(String[]::new);
new BatchBackupOptions(null, valid).getDeleteOpOptions(pkg, userId);
Defensive patterns

Strategy: validation

Validate before calling

List<String> valid = Arrays.stream(names)
    .filter(n -> BackupUtils.retrieveLatestBackupFromDb(userId, n, packageName) != null)
    .collect(Collectors.toList());
if (valid.size() != names.length)
    Log.w(TAG, "Skipping missing backups: " + (Arrays.asList(names).removeAll(valid) ? "" : ""));

Try / catch

try {
    options.getDeleteOpOptions(pkg, userId);
} catch (IllegalArgumentException e) {
    if (e.getMessage() != null && e.getMessage().contains("doesn't exist")) {
        // remove that name and retry remaining entries
    } else throw e;
}

Prevention

When it happens

Trigger: Calling deleteBackups with BatchBackupOptions where any name in mBackupNames has no matching backup record in the DB for the given package/user; the loop throws on the first missing name.

Common situations: Deleting several backups where some were already removed (e.g. partially successful prior delete or clean-up script); typos in one of many names; user-ID mismatch; database not reflecting on-disk backups.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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