MuntashirAkon/AppManager · error · BackupException
not found at
Error message
not found at
What it means
When the APK's sourceDir points inside /data/app, backupApkFiles() expects the base APK named by metadata.apkName to exist directly under that path; FileNotFoundException from Path.findFile() is wrapped in this BackupException with the APK name and searched directory in the message. The backup cannot proceed because the base APK to archive is missing.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupOp.java:322
BitmapRandomizer.randomizePixel(bitmap);
bitmap.compress(Bitmap.CompressFormat.PNG, 100, outputStream);
}
} catch (IOException e) {
Log.w(TAG, "Could not back up icon.");
}
}
private void backupApkFiles() throws BackupException {
Path dataAppPath = OsEnvironment.getDataAppDirectory();
final String sourceBackupFilePrefix = BackupUtils.getSourceFilePrefix(getExt(mMetadata.info.tarType));
Path sourceDir = Paths.get(PackageUtils.getSourceDir(mApplicationInfo));
if (dataAppPath.equals(sourceDir)) {
// APK located inside /data/app directory
// Backup only the apk file (no split apk support for this type of apk)
try {
sourceDir = sourceDir.findFile(mMetadata.metadata.apkName);
} catch (FileNotFoundException e) {
throw new BackupException(mMetadata.metadata.apkName + " not found at " + sourceDir);
}
}
Path[] sourceFiles;
try {
sourceFiles = TarUtils.create(mMetadata.info.tarType, sourceDir, mBackupItem.getUnencryptedBackupPath(), sourceBackupFilePrefix,
/* language=regexp */ new String[]{".*\\.apk"}, null, null, false).toArray(new Path[0]);
} catch (Throwable th) {
throw new BackupException("APK files backup is requested but no source directory has been backed up.", th);
}
try {
sourceFiles = mBackupItem.encrypt(sourceFiles);
} catch (IOException e) {
throw new BackupException("Failed to encrypt " + Arrays.toString(sourceFiles), e);
}
for (Path file : sourceFiles) {
mChecksum.add(file.getName(), DigestUtils.getHexDigest(mMetadata.info.checksumAlgo, file));
}
}View on GitHub (pinned to 0152f468fc)
Solutions
- Refresh metadata for the app (re-read PackageInfo/applicationInfo.sourceDir) so apkName matches the current installation.
- Update the app and back up again instead of reusing old metadata.
- Verify the sourceDir actually exists and the app is still installed.
- If the app is a split/featured APK, ensure the metadata apkName points at the base APK.
Example fix
// before mMetadata.metadata.apkName = oldPackageInfo.applicationInfo.sourceDir; // stale name // after PackageInfo pi = pm.getPackageInfo(pkg, GET_METADATA); mMetadata.metadata.apkName = new File(pi.applicationInfo.sourceDir).getName();
Defensive patterns
Strategy: validation
Validate before calling
String currentApk = new File(pm.getPackageInfo(pkg, 0).applicationInfo.sourceDir).getName();
if (!currentApk.equals(metadata.apkName)) { refreshMetadata(); } Type guard
boolean apkNameMatches(BackupMetadata meta, PackageManager pm) {
try {
String src = pm.getPackageInfo(meta.packageName, 0).applicationInfo.sourceDir;
return src != null && new File(src).getName().equals(meta.apkName);
} catch (Exception e) { return false; }
} Try / catch
try {
backupOp.runBackup(progress);
} catch (BackupException e) {
if (e.getMessage().contains("not found at")) { refreshMetadataAndRetry(); }
} Prevention
- Refresh metadata after every app update before re-backup.
- Compare metadata.apkName against the live sourceDir before backup.
- Handle apps that moved between internal/external storage.
- Recreate rather than reuse backups made before reinstalls.
When it happens
Trigger: mMetadata.metadata.apkName no longer matches the on-disk APK filename in the /data/app directory — typically because the app was updated/reinstalled after the metadata was created, so the versioned apk filename changed.
Common situations: Restoring/redoing a backup created before an app update; apps moved between storage volumes changing their /data/app path; stale cached metadata.
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
- Destination doesn't contain any APK files.
- Could not get base.apk file.
- Could not get backup files.
- APK files backup is requested but no source directory has be
- Failed to encrypt
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/e0a360f891d78938.
Report an issue: GitHub.