MuntashirAkon/AppManager · error · IllegalArgumentException
Backup with name ${mBackupNames[0]} doesn't exist.
Error message
Backup with name ${mBackupNames[0]} doesn't exist. What it means
BatchBackupOptions.getRestoreOpOptions() resolves the first backup name to a latest Backup record via BackupUtils.retrieveLatestBackupFromDb(userId, mBackupNames[0], packageName); if the DB returns null, it throws IllegalArgumentException. It means no backup matching the given name exists for that package/user, so no relative directory can be resolved for the restore operation.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/batchops/struct/BatchBackupOptions.java:68
}
return new BackupOpOptions(packageName, userId, mFlags, backupName, !customBackup);
}
public RestoreOpOptions getRestoreOpOptions(@NonNull String packageName, @UserIdInt int userId) {
// For restore operation, backup names (v4) and relative dirs are only set for single
// package backups. In all other cases, it only uses base backups.
String relativeDir;
if (mRelativeDirs != null && mRelativeDirs.length > 0) {
relativeDir = mRelativeDirs[0];
} else {
if (mBackupNames == null || mBackupNames.length == 0) {
// Base backup
relativeDir = null;
} else {
// Generate relative directories
Backup backup = BackupUtils.retrieveLatestBackupFromDb(userId, mBackupNames[0], packageName);
if (backup == null) {
throw new IllegalArgumentException("Backup with name " + mBackupNames[0] + " doesn't exist.");
}
relativeDir = backup.relativeDir;
}
}
return new RestoreOpOptions(packageName, userId, relativeDir, mFlags);
}
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 {View on GitHub (pinned to 0152f468fc)
Solutions
- List existing backups (BackupUtils) and use an exact, existing backup name.
- Create the backup with the given name before restoring.
- Verify the userId passed matches the user the backup belongs to.
- Rebuild/refresh App Manager's backup database if backups exist on disk but not in the DB.
Example fix
// before
new BatchBackupOptions("mybackup", null, flags).getRestoreOpOptions(pkg, userId);
// after
String name = BackupUtils.getBackupNames().contains("mybackup") ? "mybackup"
: /* pick existing */ BackupUtils.getBackupNames().iterator().next();
new BatchBackupOptions(name, null, flags).getRestoreOpOptions(pkg, userId); Defensive patterns
Strategy: validation
Validate before calling
Backup b = BackupUtils.retrieveLatestBackupFromDb(userId, backupName, packageName);
if (b == null) throw new IllegalArgumentException("No backup named '" + backupName + "' for " + packageName + " user " + userId); Try / catch
try {
options.getRestoreOpOptions(pkg, userId);
} catch (IllegalArgumentException e) {
if (e.getMessage() != null && e.getMessage().contains("doesn't exist")) {
// surface available backup names to the user
} else throw e;
} Prevention
- Resolve backup names from BackupUtils listings instead of hardcoding strings.
- Always pair name lookups with the same userId used in the op options.
- Re-sync the backup DB after migrating backups between devices.
When it happens
Trigger: Calling restoreBackups with a BatchBackupOptions whose first backup name has no matching record in App Manager's backup database for the given package and user ID.
Common situations: Typo in the backup name; backup deleted or never created; querying under a different user ID than the one the backup was made under; stale database after backups were moved between devices.
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
- Backup with name ${mBackupNames[i]} doesn't exist.
- No base backup found.
- Package not found.
- Couldn't delete old file <inputFile>
- Could not delete <mBackupPath>
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/441ecfb6679ab39a.
Report an issue: GitHub.