{"record":{"id":"f99f87531b60355f","repo":"MuntashirAkon/AppManager","slug":"for-path","errorCode":null,"errorMessage":" for path ","messagePattern":" for path ","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/io/github/muntashirakon/AppManager/backup/MetadataManager.java","lineNumber":63,"sourceCode":"    }\n\n    @NonNull\n    @WorkerThread\n    public static BackupMetadataV5.Info readInfo(@NonNull BackupItems.BackupItem backupItem) throws IOException {\n        boolean v5AndUp = backupItem.isV5AndUp();\n        Path infoFile = v5AndUp ? backupItem.getInfoFile() : backupItem.getMetadataV2File();\n        String infoString = infoFile.getContentAsString();\n        JSONObject jsonObject;\n        if (TextUtils.isEmpty(infoString)) {\n            throw new IOException(\"Empty JSON string for path \" + infoFile);\n        }\n        try {\n            jsonObject = new JSONObject(infoString);\n            BackupMetadataV5.Info info = new BackupMetadataV5.Info(jsonObject);\n            info.setBackupItem(backupItem);\n            return info;\n        } catch (JSONException e) {\n            throw new IOException(e.getMessage() + \" for path \" + infoFile, e);\n        }\n    }\n\n    @NonNull\n    @WorkerThread\n    public static BackupMetadataV5 readMetadata(@NonNull BackupItems.BackupItem backupItem) throws IOException {\n        BackupMetadataV5.Info info = readInfo(backupItem);\n        return readMetadata(backupItem, info);\n    }\n\n    @NonNull\n    @WorkerThread\n    public static BackupMetadataV5 readMetadata(@NonNull BackupItems.BackupItem backupItem,\n                                                @NonNull BackupMetadataV5.Info backupInfo)\n            throws IOException {\n        boolean v5AndUp = backupItem.isV5AndUp();\n        if (v5AndUp) {\n            // Need to setup crypto in order to decrypt meta_v5.am.json","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/MuntashirAkon/AppManager/blob/0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5/app/src/main/java/io/github/muntashirakon/AppManager/backup/MetadataManager.java#L45-L81","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Validate the info file with a JSON linter/parser to find the syntax error, then fix or regenerate it.","Restore the backup files from a known-good copy of the archive.","Check decryption configuration — wrong keys can yield garbage that fails to parse."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"String s = infoFile.getContentAsString();\ntry { new JSONObject(s); } catch (JSONException e) { /* invalid info JSON, repair before readInfo */ }","typeGuard":null,"tryCatchPattern":"try {\n    BackupMetadataV5.Info info = MetadataManager.readInfo(backupItem);\n} catch (IOException e) {\n    Throwable c = e.getCause();\n    if (c instanceof JSONException) {\n        // log path + cause; restore backup from a good copy\n    } else throw e;\n}","preventionTips":["Do not manually edit backup JSON files; regenerate backups instead.","Validate JSON after editing tooling that rewrites metadata.","Keep at least one verified copy of each backup archive."],"tags":["backup","json","parse-error","io"],"backgroundTag":"json-parse-error","analyzedSha":"0152f468fc9463ee02dc2ca83f6fe4989a2c4ca5","analyzedAt":"2026-09-12T14:03:37.243Z","contentChangedAt":"2026-09-12T14:03:37.243Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}