MuntashirAkon/AppManager · error · IOException

for path

Error message

 for path 

What it means

readInfo wraps JSONException when parsing the info file content. The original JSONException message is rethrown as an IOException with the file path appended, preserving the cause, so invalid JSON in a backup's info file is reported with its location.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/backup/MetadataManager.java:63

    }

    @NonNull
    @WorkerThread
    public static BackupMetadataV5.Info readInfo(@NonNull BackupItems.BackupItem backupItem) throws IOException {
        boolean v5AndUp = backupItem.isV5AndUp();
        Path infoFile = v5AndUp ? backupItem.getInfoFile() : backupItem.getMetadataV2File();
        String infoString = infoFile.getContentAsString();
        JSONObject jsonObject;
        if (TextUtils.isEmpty(infoString)) {
            throw new IOException("Empty JSON string for path " + infoFile);
        }
        try {
            jsonObject = new JSONObject(infoString);
            BackupMetadataV5.Info info = new BackupMetadataV5.Info(jsonObject);
            info.setBackupItem(backupItem);
            return info;
        } catch (JSONException e) {
            throw new IOException(e.getMessage() + " for path " + infoFile, e);
        }
    }

    @NonNull
    @WorkerThread
    public static BackupMetadataV5 readMetadata(@NonNull BackupItems.BackupItem backupItem) throws IOException {
        BackupMetadataV5.Info info = readInfo(backupItem);
        return readMetadata(backupItem, info);
    }

    @NonNull
    @WorkerThread
    public static BackupMetadataV5 readMetadata(@NonNull BackupItems.BackupItem backupItem,
                                                @NonNull BackupMetadataV5.Info backupInfo)
            throws IOException {
        boolean v5AndUp = backupItem.isV5AndUp();
        if (v5AndUp) {
            // Need to setup crypto in order to decrypt meta_v5.am.json

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Validate the info file with a JSON linter/parser to find the syntax error, then fix or regenerate it.
  2. Restore the backup files from a known-good copy of the archive.
  3. Check decryption configuration — wrong keys can yield garbage that fails to parse.
Defensive patterns

Strategy: try-catch

Validate before calling

String s = infoFile.getContentAsString();
try { new JSONObject(s); } catch (JSONException e) { /* invalid info JSON, repair before readInfo */ }

Try / catch

try {
    BackupMetadataV5.Info info = MetadataManager.readInfo(backupItem);
} catch (IOException e) {
    Throwable c = e.getCause();
    if (c instanceof JSONException) {
        // log path + cause; restore backup from a good copy
    } else throw e;
}

Prevention

When it happens

Trigger: readInfo encounters a non-empty but syntactically invalid JSON file (info.am.json or meta_v2.am.json) — e.g. manually edited files, partially written files, or binary/garbage content from failed decryption.

Common situations: Hand-editing backup metadata and breaking JSON syntax, an interrupted backup write leaving a partial file, or wrong crypto settings causing garbage output that is fed to the parser.

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/f99f87531b60355f. Report an issue: GitHub.