MuntashirAkon/AppManager · error · BackupException
No base backup found.
Error message
No base backup found.
What it means
When RestoreOpOptions.relativeDir is null, restore() falls back to the 'base backup' recorded in the backup database for (userId, packageName). If BackupUtils.retrieveBaseBackupFromDb() returns null, there is no registered base backup, so the method throws BackupException('No base backup found.'). It means the backup metadata DB has no entry for that package/user.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupManager.java:112
public void restore(@NonNull RestoreOpOptions options, @Nullable ProgressHandler progressHandler)
throws BackupException {
if (options.packageName.equals("android")) {
throw new BackupException("Android System (android) cannot be restored.");
}
if (options.flags.isEmpty()) {
throw new BackupException("Restore is requested without any flags.");
}
BackupItems.BackupItem backupItem;
try {
if (options.relativeDir != null) {
backupItem = BackupItems.findBackupItem(options.relativeDir);
} else {
// Use base backup
Backup baseBackup = BackupUtils.retrieveBaseBackupFromDb(options.userId, options.packageName);
if (baseBackup != null) {
backupItem = baseBackup.getItem();
} else {
throw new BackupException("No base backup found.");
}
}
} catch (IOException e) {
throw new BackupException("Could not get backup files.", e);
}
if (progressHandler != null) {
int max = calculateMaxProgress(options.flags);
progressHandler.setProgressTextInterface(ProgressHandler.PROGRESS_PERCENT);
progressHandler.postUpdate(max, 0f);
}
try (RestoreOp restoreOp = new RestoreOp(options.packageName, options.flags, backupItem, options.userId)) {
restoreOp.runRestore(progressHandler);
mRequiresRestart |= restoreOp.requiresRestart();
}
}
public void deleteBackup(@NonNull DeleteOpOptions options) throws BackupException {
List<BackupItems.BackupItem> backupItemList;View on GitHub (pinned to 0152f468fc)
Solutions
- Pass options.relativeDir pointing at the specific backup directory instead of relying on the base backup.
- Re-import/register the existing backup folder so a base-backup entry is created in the DB.
- Verify packageName and userId match the entry used when the backup was made.
- Run a backup first (or use the UI's backup list) so a base backup exists, then restore.
Example fix
// before options.relativeDir = null; // relies on base backup // after options.relativeDir = "com.example.app/20240101_120000"; // explicit backup dir
Defensive patterns
Strategy: validation
Validate before calling
Backup base = BackupUtils.retrieveBaseBackupFromDb(userId, pkg);
if (base == null) {
throw new IllegalStateException("No base backup for " + pkg + " user " + userId + "; specify relativeDir");
} Type guard
boolean hasBaseBackup(int userId, String pkg) {
return BackupUtils.retrieveBaseBackupFromDb(userId, pkg) != null;
} Try / catch
try {
manager.restore(options, progress);
} catch (BackupException e) {
if (e.getMessage().contains("No base backup")) { /* fall back to explicit relativeDir */ }
} Prevention
- Pass explicit relativeDir instead of relying on the base backup
- Keep packageName/userId consistent with the backup-time values
- Re-register backup folders after app reinstall so the DB is populated
When it happens
Trigger: Calling restore() without options.relativeDir for a package that has no base-backup row in the database (never backed up with this app, DB wiped, or backup files exist on disk but were never registered).
Common situations: Restoring on a fresh install of AppManager where the backup DB is empty but old backup folders still exist in the backup directory; wrong userId passed so the DB lookup targets the wrong user; typo in packageName.
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
- Android System (android) cannot be restored.
- Restore is requested without any flags.
- Could not get backup files.
- Failed to get crypto
- Could not read backup info. Possibly due to a malformed json
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/d515755b91d828d7.
Report an issue: GitHub.