MuntashirAkon/AppManager · error · BackupException
Failed to load rules from misc.
Error message
Failed to load rules from misc.
What it means
Thrown by loadMiscRules when rules.loadExternalEntries(miscFile) throws any Throwable while parsing the decrypted misc file into PseudoRules entries. The decryption succeeded, but the file's content could not be interpreted as valid misc rules.
Source
Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/RestoreOp.java:748
if (!mRequestedFlags.skipSignatureCheck()) {
String checksum = DigestUtils.getHexDigest(mBackupInfo.checksumAlgo, miscFile);
if (!checksum.equals(mChecksum.get(miscFile.getName()))) {
throw new BackupException("Couldn't verify misc file." +
"\nFile: " + miscFile +
"\nFound: " + checksum +
"\nRequired: " + mChecksum.get(miscFile.getName()));
}
}
// Decrypt permission file
try {
miscFile = mBackupItem.decrypt(new Path[]{miscFile})[0];
} catch (IOException | IndexOutOfBoundsException e) {
throw new BackupException("Failed to decrypt " + miscFile.getName(), e);
}
try {
rules.loadExternalEntries(miscFile);
} catch (Throwable e) {
throw new BackupException("Failed to load rules from misc.", e);
}
}
private void restoreRules() throws BackupException {
// Apply rules
if (!mIsInstalled) {
throw new BackupException("Rules restore is requested but the app isn't installed.");
}
Path rulesFile;
try {
rulesFile = mBackupItem.getRulesFile();
} catch (IOException e) {
if (mBackupMetadata.hasRules) {
throw new BackupException("Rules file is missing.", e);
} else {
// There are no rules, just skip
return;
}View on GitHub (pinned to 0152f468fc)
Solutions
- Update AppManager to a version compatible with the backup's format (or use the version that created the backup)
- Inspect the decrypted misc file to confirm it parses as expected permissions data
- Regenerate the backup from a working device so the misc file is written in the current format
- If the misc data is unimportant, disable misc restore and continue with data restore
Example fix
// before
rules.loadExternalEntries(miscFile);
// after
try {
rules.loadExternalEntries(miscFile);
} catch (Throwable e) {
Log.w(TAG, "Misc rules unparseable; skipping misc restore", e);
} Defensive patterns
Strategy: try-catch
Validate before calling
try (InputStream in = miscFile.openInputStream()) {
if (in.read() == -1) throw new IllegalStateException("Decrypted misc file is empty; rules parsing will fail");
} Try / catch
try {
restoreOp.runRestore();
} catch (BackupException e) {
if ("Failed to load rules from misc.".equals(e.getMessage())) {
Log.w(TAG, "Skipping misc rules; data restore continues", e.getCause());
} else throw e;
} Prevention
- Restore backups with a compatible AppManager version
- Verify decrypted output looks sane before parsing
- Treat misc rules as optional in restore workflows
When it happens
Trigger: loadExternalEntries throws during parsing — e.g. malformed/unrecognized format in the decrypted misc file, version mismatch between the backup's misc format and the current AppManager parser, or a read error mid-parse.
Common situations: Restoring a backup produced by an older/newer AppManager with a changed misc format; the decrypted file is garbage because decryption silently used the wrong parameters; hand-crafted misc files.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- Couldn't verify misc file.\nFile: ${miscFile}\nFound: ${chec
- Failed to decrypt ${miscFile.getName()}
- Resource ${resName} is not found.
- "manifest" has duplicate "application" tags.
- Couldn't delete old file <inputFile>
AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12).
Data as JSON: /api/errors/881c42df4cbb4115.
Report an issue: GitHub.