MuntashirAkon/AppManager · error · IOException

Empty JSON string for path

Error message

Empty JSON string for path 

What it means

readInfo parses the backup's info file (info.am.json for v5+, meta_v2.am.json otherwise). It throws IOException when the file content string is empty because a valid JSON info document is mandatory to identify and decrypt a backup.

Source

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

    @VisibleForTesting
    public static void setCurrentBackupMetaVersion(int version) {
        currentBackupMetaVersion = version;
    }

    public static int getCurrentBackupMetaVersion() {
        return currentBackupMetaVersion;
    }

    @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);
    }

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Verify the backup directory contains info.am.json (v5+) or meta_v2.am.json and that it is non-empty before reading.
  2. Re-copy/redownload the backup archive — the file is likely truncated or corrupted.
  3. If decryption is configured, ensure the crypto settings are correct so content decrypts to valid text.

Example fix

// before
BackupMetadataV5.Info info = MetadataManager.readInfo(backupItem);
// after
if (!backupItem.getInfoFile().exists() || TextUtils.isEmpty(backupItem.getInfoFile().getContentAsString())) {
    throw new IOException("Backup info file missing or empty: " + backupItem.getBackupName());
}
BackupMetadataV5.Info info = MetadataManager.readInfo(backupItem);
Defensive patterns

Strategy: try-catch

Validate before calling

Path infoFile = backupItem.isV5AndUp() ? backupItem.getInfoFile() : backupItem.getMetadataV2File();
String s = infoFile.getContentAsString();
if (TextUtils.isEmpty(s)) throw new IOException("Missing/empty info file: " + infoFile);

Try / catch

try {
    BackupMetadataV5.Info info = MetadataManager.readInfo(backupItem);
} catch (IOException e) {
    if (e.getMessage().startsWith("Empty JSON string")) {
        // flag backup as corrupted/incomplete and surface to the user
    } else throw e;
}

Prevention

When it happens

Trigger: Calling readInfo (directly or via info) on a BackupItem whose info/metadata file is missing, zero-byte, or failed to decrypt to readable text.

Common situations: Corrupted or truncated backup archives (interrupted transfer), backups created by old versions with different file names, or selecting the wrong directory so the expected info file doesn't exist and content comes back empty.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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