MuntashirAkon/AppManager · error · BackupException
Could not get backup files.
Error message
Could not get backup files.
What it means
In restore(), when resolving the BackupItem (from relativeDir or the base backup), an IOException can occur while touching the backup files; it is wrapped and rethrown as BackupException('Could not get backup files.', e). It signals I/O trouble reading the backup directory/metadata — typically missing, unreadable, or moved files.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupManager.java:116
}
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;
if (options.relativeDirs == null) {
// Delete base backup
Backup baseBackup = BackupUtils.retrieveBaseBackupFromDb(options.userId, options.packageName);
if (baseBackup != null) {View on GitHub (pinned to 0152f468fc)
Solutions
- Check the cause (getCause()) to see the underlying IOException and path.
- Verify the backup directory exists and is readable under the app's backup location.
- Re-mount/enable access to the storage volume holding the backup; move backups to internal storage if external access is flaky.
- Recreate the backup if the files are gone; catch BackupException and inform the user the backup is unusable.
Example fix
// before
manager.restore(options, progress); // fails silently on bad path
// after
try {
manager.restore(options, progress);
} catch (BackupException e) {
Log.e(TAG, "Backup files unreadable", e.getCause());
} Defensive patterns
Strategy: try-catch
Validate before calling
File dir = options.relativeDir != null ? new File(backupRoot, options.relativeDir) : null;
if (dir != null && (!dir.exists() || !dir.canRead())) {
throw new IllegalStateException("Backup files missing/unreadable: " + dir);
} Type guard
boolean backupReadable(String relDir) {
File d = new File(backupRoot, relDir);
return d.isDirectory() && d.canRead() && d.list().length > 0;
} Try / catch
try {
manager.restore(options, progress);
} catch (BackupException e) {
if ("Could not get backup files.".equals(e.getMessage())) {
IOException io = (IOException) e.getCause(); // inspect path
}
} Prevention
- Verify storage volume is mounted before restore ops
- Keep backups on stable internal storage when possible
- Log e.getCause() to identify the failing path
When it happens
Trigger: restore() with a relativeDir whose files are missing/unreadable, or a base backup whose getItem() throws IOException because the underlying files were deleted or the storage is unavailable.
Common situations: Backup stored on external/SD storage that is unmounted; backup directory renamed or moved; files deleted by a cleaner app; permission issues on /storage after reboot; pointing at a relativeDir that doesn't exist.
Understand the failure class
Background: "failed to read file", EACCES, ENOENT and "could not read <path>" errors: when a program can't read a file from disk — this error's family across 49 libraries.
Related errors
- Android System (android) cannot be restored.
- Restore is requested without any flags.
- No base backup found.
- Could not retrieve metadata from backup.
- Failed to create checksum file.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/da0182746ecf8255.
Report an issue: GitHub.