MuntashirAkon/AppManager · error · BackupException
Unknown error occurred
Error message
Unknown error occurred
What it means
runRestore rethrows BackupException as-is but wraps every other Throwable into a generic BackupException 'Unknown error occurred'. This catch-all marks an unexpected failure anywhere in the restore pipeline (I/O, decompression, rules application, progress handling) that no specific branch anticipated.
Solutions
- Read the wrapped cause (getCause()) — it names the real failing operation
- Check free storage space and retry the restore
- Verify the backup archive files are not truncated/corrupt
- Reproduce with logging enabled and report the cause stack trace if it indicates an app bug
Example fix
// before
} catch (Throwable th) {
throw new BackupException("Unknown error occurred", th);
}
// after
} catch (IOException e) {
throw new BackupException("Restore failed on backup files: " + e.getMessage(), e);
} catch (Throwable th) {
throw new BackupException("Unknown error occurred: " + th.getClass().getName(), th);
} Defensive patterns
Strategy: try-catch
Validate before calling
long usable = new File(restoreTarget).getUsableSpace();
if (usable < estimatedBackupSize) throw new BackupException("Insufficient storage for restore"); Try / catch
try { runRestore(progressHandler); } catch (BackupException e) { Throwable cause = e.getCause(); log("Restore failed: " + (cause != null ? cause : e)); retryOnceOrReport(cause); } Prevention
- Always inspect getCause() — the generic message hides the real failure
- Ensure sufficient free storage and battery before large restores
- Keep the app updated; report unexpected causes as bugs with full stack traces
- Avoid killing the process mid-restore
When it happens
Trigger: Any non-BackupException Throwable during runRestore: tar extraction failure, IOException on package files, NullPointerException, OOM, interruption during restoreRules or per-item steps.
Common situations: Corrupted archive members inside the backup; storage full mid-restore; app bug surfacing as NPE; device ran out of memory restoring a large app; restore interrupted by system killing the process.
Understand the failure class
Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.
Related errors
- Android System (android) cannot be restored.
- Could not get backup files.
- Could not get crypto
- Could not read backup info. Possibly due to a malformed…
- Could not read backup metadata. Possibly due to a malformed…
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/b75fbe573f47f9de.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:203
if (mRequestedFlags.backupData()) {
restoreData();
if (mBackupMetadata.keyStore) {
restoreKeyStore();
}
incrementProgress(progressHandler);
}
if (mRequestedFlags.backupExtras()) {
restoreExtras();
incrementProgress(progressHandler);
}
if (mRequestedFlags.backupRules()) {
restoreRules();
incrementProgress(progressHandler);
}
} catch (BackupException e) {
throw e;
} catch (Throwable th) {
throw new BackupException("Unknown error occurred", th);
}
}
private static void incrementProgress(@Nullable ProgressHandler progressHandler) {
if (progressHandler == null) {
return;
}
float current = progressHandler.getLastProgress() + 1;
progressHandler.postUpdate(current);
}
public boolean requiresRestart() {
return mRequiresRestart;
}
private void verifyMetadata() throws BackupException {
boolean isV5AndUp = mBackupItem.isV5AndUp();
if (isV5AndUp) {View on GitHub (pinned to 0152f468fc)