MuntashirAkon/AppManager · error · BackupException
There were some KeyStore items but they couldn't be cached…
Error message
There were some KeyStore items but they couldn't be cached before taking a backup.
What it means
After attempting to cache all KeyStore files, backupKeyStore() verifies at least one was actually cached. If the list is empty despite keystore items being requested, it throws this BackupException, aborting rather than writing an empty keystore backup.
Solutions
- Verify the app/uid actually owns keystore files at the expected path
- Skip the keystore backup item when no keystore files exist instead of requesting it
- Log the keystore directory listing before caching to confirm files are discovered
- Check filename pattern/uid replacement logic if files exist but are filtered out
Example fix
// before
if (cachedKeyStoreFileNames.isEmpty()) {
throw new BackupException("There were some KeyStore items but they couldn't be cached before taking a backup.");
}
// after
if (cachedKeyStoreFileNames.isEmpty()) {
Log.w(TAG, "No keystore files found for uid " + mApplicationInfo.uid + "; skipping keystore backup");
return;
} Defensive patterns
Strategy: validation
Validate before calling
if (keystoreItemRequested && listKeystoreFiles(uid).isEmpty()) {
Log.w(TAG, "no keystore files for uid " + uid + "; drop keystore item");
return;
} Type guard
static boolean hasCachedFiles(List<String> cached) {
return cached != null && !cached.isEmpty();
} Try / catch
try {
runBackup();
} catch (BackupException e) {
if (e.getMessage().contains("couldn't be cached")) degradeToBackupWithoutKeystore();
else throw e;
} Prevention
- Only request keystore item when keystore files exist for the uid
- Log directory listing before caching
- Treat empty keystore as a skip, not an error
When it happens
Trigger: Every IoUtils.copy attempt failed silently-range (each threw and was rethrown) — actually if any throws it aborts earlier; this fires when the keystore item contained no matching files at all (findFile/filter yielded nothing) so cachedKeyStoreFileNames stayed empty.
Common situations: Keystore directory empty or path resolution returned no files for the uid; filter pattern mismatch after uid→placeholder renaming; app has a keystore backup flag set but no keystore entries exist for the uid.
Understand the failure class
Background: EmptyResultError / "no results found": when an API or scraper succeeds but returns zero rows — this error's family across 9 libraries.
Related errors
- Checksums for master key did not match.
- Could not backup KeyStore item.
- Could not cache
- Could not verify KeyStore files.\nFile: " + file.getName()…
- Failed to rename KeyStore files
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/12b42f14edb3916e.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/BackupOp.java:425
} catch (FileNotFoundException ignore) {
}
// Store the KeyStore files
Path cachePath = Paths.get(FileUtils.getCachePath());
List<String> cachedKeyStoreFileNames = new ArrayList<>();
List<String> keyStoreFilters = new ArrayList<>();
for (String keyStoreFileName : KeyStoreUtils.getKeyStoreFiles(mApplicationInfo.uid, mUserId)) {
try {
String newFileName = Utils.replaceOnce(keyStoreFileName, String.valueOf(mApplicationInfo.uid),
String.valueOf(KEYSTORE_PLACEHOLDER));
IoUtils.copy(keyStorePath.findFile(keyStoreFileName), cachePath.findOrCreateFile(newFileName, null));
cachedKeyStoreFileNames.add(newFileName);
keyStoreFilters.add(Pattern.quote(newFileName));
} catch (Throwable e) {
throw new BackupException("Could not cache " + keyStoreFileName, e);
}
}
if (cachedKeyStoreFileNames.isEmpty()) {
throw new BackupException("There were some KeyStore items but they couldn't be cached before taking a backup.");
}
String keyStorePrefix = KEYSTORE_PREFIX + getExt(mMetadata.info.tarType);
Path[] backedUpKeyStoreFiles;
try {
backedUpKeyStoreFiles = TarUtils.create(mMetadata.info.tarType, cachePath, mBackupItem.getUnencryptedBackupPath(), keyStorePrefix,
keyStoreFilters.toArray(new String[0]), null, null, false)
.toArray(new Path[0]);
} catch (Throwable th) {
throw new BackupException("Could not backup KeyStore item.", th);
}
// Remove cache
for (String name : cachedKeyStoreFileNames) {
try {
cachePath.findFile(name).delete();
} catch (FileNotFoundException ignore) {
}
}
try {View on GitHub (pinned to 0152f468fc)