MuntashirAkon/AppManager · error · BackupException
ADB restore is requested but there are no .ab files.
Error message
ADB restore is requested but there are no .ab files.
What it means
Thrown by restoreAdb when an ADB-based backup restore was requested but the backup directory does not contain exactly one .ab (Android backup) file for the given index. The ADB restore path expects a single adb archive; an empty or malformed dataFiles array means the required archive is absent.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:606
} catch (Throwable th) {
throw new BackupException("Failed to restore data files for index " + index + ".", th);
}
// Restore UID and GID
if (!Runner.runCommand(String.format(Locale.ROOT, "chown -R %d:%d \"%s\"", uidGidPair.uid, uidGidPair.gid, dataSourceFile.getFilePath())).isSuccessful()) {
if (!Utils.isRoboUnitTest()) {
throw new BackupException("Failed to restore ownership info for index " + index + ".");
} // else Don't care about permissions
}
// Restore context
if (!dataDirectoryInfo.isExternal()) {
Runner.runCommand(new String[]{"restorecon", "-R", dataSourceFile.getFilePath()});
}
}
private void restoreAdb(int index) throws BackupException {
Path[] dataFiles = mBackupItem.getDataFiles(index);
if (dataFiles.length != 1) {
throw new BackupException("ADB restore is requested but there are no .ab files.");
}
// Decrypt data
try {
dataFiles = mBackupItem.decrypt(dataFiles);
} catch (IOException e) {
throw new BackupException("Failed to decrypt " + Arrays.toString(dataFiles), e);
}
// Restore data
try (InputStream is = dataFiles[0].openInputStream()) {
ParcelFileDescriptor fd = ParcelFileDescriptorUtil.pipeFrom(is);
BackupCompat.adbRestore(mUserId, fd);
} catch (Throwable th) {
throw new BackupException("Failed to restore ADB data", th);
}
}
private synchronized void restoreExtras() throws BackupException {
if (!mIsInstalled) {View on GitHub (pinned to 0152f468fc)
Solutions
- Verify the backup directory contains exactly one .ab file for the requested index before starting the restore
- Re-copy the complete backup folder from its original location including all archives
- Check Metadata.json / backup mode: if the backup was created in files mode, use the files restore path instead of ADB
- Re-create the backup with ADB mode if the archive is genuinely lost
Example fix
// before
Path[] dataFiles = mBackupItem.getDataFiles(index);
// assume it's fine
// after
Path[] dataFiles = mBackupItem.getDataFiles(index);
if (dataFiles.length != 1 || !dataFiles[0].getName().endsWith(".ab")) {
throw new IllegalStateException("Backup folder is missing the required .ab archive; restore aborted before BackupException");
} Defensive patterns
Strategy: validation
Validate before calling
Path[] files = mBackupItem.getDataFiles(index);
long abCount = Arrays.stream(files).filter(f -> f.getName().endsWith(".ab")).count();
if (abCount != 1) throw new IllegalStateException("Expected exactly one .ab file, found " + abCount); Try / catch
try {
restoreOp.runRestore();
} catch (BackupException e) {
if (e.getMessage().contains("no .ab files")) {
showUserMessage("Backup archive (.ab) is missing; cannot ADB-restore this backup.");
} else throw e;
} Prevention
- Always copy the whole backup directory, not just selected files
- Cross-check the backup mode in metadata before choosing the restore path
- Validate backup contents (checksums/file listing) before starting a restore
When it happens
Trigger: Calling restoreAdb when mBackupItem.getDataFiles(index) returns an array whose length != 1 — i.e. zero .ab files (or more than one) present in the backup for that index.
Common situations: Restoring a backup whose mode is ADB but the .ab file was deleted, not copied along with the rest of the backup folder, or the backup was actually created with a different mode (files/tar) so no .ab archive exists.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Failed to backup ADB data.
- Failed to restore ADB data
- Rules file is missing.
- 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/35114908b26b08b8.
Report an issue: GitHub.