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

  1. Read the wrapped cause (getCause()) — it names the real failing operation
  2. Check free storage space and retry the restore
  3. Verify the backup archive files are not truncated/corrupt
  4. 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

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


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)