MuntashirAkon/AppManager · error · BackupException

Could not read backup info. Possibly due to a malformed…

Error message

Could not read backup info. Possibly due to a malformed json file.

What it means

The VerifyOp constructor calls mBackupItem.getInfo() to parse backup.json. If reading or JSON-parsing that file throws an IOException, cleanup() runs and this BackupException is thrown. It means the backup descriptor file is missing, unreadable, or not valid JSON.

Solutions

  1. Validate backup.json with a JSON parser/validator and fix syntax errors if it was hand-edited.
  2. Re-copy the complete backup directory from the source device, including backup.json.
  3. Recreate the backup on the source device if the original file is truncated.
  4. Check file permissions/readability of backup.json for the AppManager process.

Example fix

// before: backup.json with trailing comma
{"flags": "...",}
// after: valid JSON
{"flags": "..."}
Defensive patterns

Strategy: validation

Validate before calling

// Validate backup.json parses before constructing VerifyOp
File f = new File(backupDir, "backup.json");
if (!f.isFile() || f.length() == 0) throw new IllegalStateException("backup.json missing/empty");
try (FileInputStream in = new FileInputStream(f)) {
    new JSONObject(new String(IOUtils.readFully(in))); // throws if malformed
}

Try / catch

try {
    new VerifyOp(backupItem).verify();
} catch (BackupException e) {
    if (e.getMessage().contains("malformed json")) {
        // re-copy or regenerate the backup
    }
}

Prevention

When it happens

Trigger: Constructing VerifyOp (or running verify) on a backup directory where backup.json is absent, truncated, or contains malformed JSON — typically after an interrupted backup or a partial copy.

Common situations: Backing up to SD card/cloud that dropped files during transfer, manually edited backup.json with a syntax error, restoring only part of a backup directory, or file-permission issues making backup.json unreadable.

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


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/26c4190112ea8834. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/VerifyOp.java:39

    @NonNull
    private final BackupFlags mBackupFlags;
    @NonNull
    private final BackupMetadataV5.Info mBackupInfo;
    @NonNull
    private final BackupMetadataV5.Metadata mBackupMetadata;
    @NonNull
    private final BackupItems.BackupItem mBackupItem;
    @NonNull
    private final BackupItems.Checksum mChecksum;

    VerifyOp(@NonNull BackupItems.BackupItem backupItem) throws BackupException {
        mBackupItem = backupItem;
        try {
            mBackupInfo = mBackupItem.getInfo();
            mBackupFlags = mBackupInfo.flags;
        } catch (IOException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not read backup info. Possibly due to a malformed json file.", e);
        }
        // Setup crypto
        if (!CryptoUtils.isAvailable(mBackupInfo.crypto)) {
            mBackupItem.cleanup();
            throw new BackupException("Mode " + mBackupInfo.crypto + " is currently unavailable.");
        }
        try {
            mBackupItem.setCrypto(mBackupInfo.getCrypto());
        } catch (CryptoException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not get crypto " + mBackupInfo.crypto, e);
        }
        try {
            mBackupMetadata = mBackupItem.getMetadata(mBackupInfo).metadata;
        } catch (IOException e) {
            mBackupItem.cleanup();
            throw new BackupException("Could not read backup metadata. Possibly due to a malformed json file.", e);
        }

View on GitHub (pinned to 0152f468fc)