MuntashirAkon/AppManager · error · BackupException
Data restore is requested but there are no data files for in
Error message
Data restore is requested but there are no data files for index ${i}. What it means
During signature/integrity verification in restoreData, if BackupFiles.BackupItem.getDataFiles(i) returns an empty array for any data directory index, this BackupException is thrown. It means the backup metadata claims a data directory exists (mBackupMetadata.dataDirs.length entries) but no corresponding backup files (tar, etc.) were found on disk.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:492
throw new BackupException("Failed to rename KeyStore files", e);
}
}
Runner.runCommand(new String[]{"restorecon", "-R", keyStorePath.getFilePath()});
}
private void restoreData() throws BackupException {
// Data restore is requested: Data restore is only possible if the app is actually
// installed. So, check if it's installed first.
if (mPackageInfo == null) {
throw new BackupException("Data restore is requested but the app isn't installed.");
}
if (!mRequestedFlags.skipSignatureCheck()) {
// Verify integrity of the data backups
String checksum;
for (int i = 0; i < mBackupMetadata.dataDirs.length; ++i) {
Path[] dataFiles = mBackupItem.getDataFiles(i);
if (dataFiles.length == 0) {
throw new BackupException("Data restore is requested but there are no data files for index " + i + ".");
}
for (Path file : dataFiles) {
checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, file);
if (!checksum.equals(mChecksum.get(file.getName()))) {
throw new BackupException("Data file verification failed for index " + i + "." +
"\nFile: " + file +
"\nFound: " + checksum +
"\nRequired: " + mChecksum.get(file.getName()));
}
}
}
}
// Force-stop and clear app data
PackageManagerCompat.clearApplicationUserData(mPackageName, mUserId);
// Restore backups
for (int i = 0; i < mBackupMetadata.dataDirs.length; ++i) {
String backupDataDir = mBackupMetadata.dataDirs[i];
if (backupDataDir.equals(BackupManager.DATA_BACKUP_SPECIAL_ADB)) {View on GitHub (pinned to 0152f468fc)
Solutions
- Re-create the backup; the existing one is incomplete and cannot pass verification.
- Copy the missing data backup files for index i into the backup directory.
- Check that external storage (SD card) containing the data backup is mounted.
- If the data dir was intentionally skipped, re-create metadata without that dataDirs entry or skip signature check (skipSignatureCheck) — not recommended.
Example fix
// before: restoring from a partial backup
ew BackupManager(...).runRestore(); // throws for missing index files
// after: validate backup completeness first
for (int i = 0; i < metadata.dataDirs.length; i++) {
if (backupItem.getDataFiles(i).length == 0) {
throw new IllegalStateException("Backup incomplete: missing data files for index " + i);
}
}
runRestore(); Defensive patterns
Strategy: validation
Validate before calling
for (int i = 0; i < metadata.dataDirs.length; i++) {
if (backupItem.getDataFiles(i).length == 0)
throw new IllegalStateException("Incomplete backup: no data files for index " + i);
}
Type guard
boolean hasAllDataFiles(BackupItem item, int dirCount) {
for (int i = 0; i < dirCount; i++) if (item.getDataFiles(i).length == 0) return false;
return true;
} Try / catch
try { runRestore(); } catch (BackupException e) {
if (e.getMessage().startsWith("Data restore is requested but there are no data files")) {
promptUserForCompleteBackup();
} else throw e;
} Prevention
- Don't move backups by copying a subset of files — copy the whole backup directory.
- Verify backups complete without interruption (check final checksums file).
- Mount external storage holding data archives before restoring.
- Match metadata and archives: never hand-edit backup metadata.
When it happens
Trigger: The backup directory is missing its data .tar/.tar.gz files for index i while metadata lists that data dir; files were deleted/moved manually; metadata (meta files) edited to add a dataDir without backing files; external-storage data backup located on an unmounted SD card.
Common situations: Partial backup (process killed mid-backup) leaving metadata but no data archives; user copied only some files when moving backups between devices; data files stored on removable storage that isn't mounted.
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
- Data restore is requested but there are no data files for in
- Android System (android) cannot be restored.
- Restore is requested without any flags.
- No base backup found.
- Could not get backup files.
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/1c2a3631489f941d.
Report an issue: GitHub.