{"record":{"id":"025d92f3abb3cb1a","repo":"beemdevelopment/Aegis","slug":"unsupported-version-025d92","errorCode":null,"errorMessage":"unsupported version","messagePattern":"unsupported version","errorType":"exception","errorClass":"VaultFileException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/vault/VaultFile.java","lineNumber":65,"sourceCode":"            throw new RuntimeException(e);\n        }\n    }\n\n    public byte[] toBytes() {\n        JSONObject obj = toJson();\n\n        try {\n            String string = obj.toString(4);\n            return string.getBytes(StandardCharsets.UTF_8);\n        } catch (JSONException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public static VaultFile fromJson(JSONObject obj) throws VaultFileException {\n        try {\n            if (obj.getInt(\"version\") > VERSION) {\n                throw new VaultFileException(\"unsupported version\");\n            }\n\n            Header header = Header.fromJson(obj.getJSONObject(\"header\"));\n            if (!header.isEmpty()) {\n                return new VaultFile(obj.getString(\"db\"), header);\n            }\n\n            return new VaultFile(obj.getJSONObject(\"db\"), header);\n        } catch (JSONException e) {\n            throw new VaultFileException(e);\n        }\n    }\n\n    public static VaultFile fromBytes(byte[] data) throws VaultFileException {\n        try {\n            JSONObject obj = new JSONObject(new String(data, StandardCharsets.UTF_8));\n            return VaultFile.fromJson(obj);\n        } catch (JSONException e) {","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/vault/VaultFile.java#L47-L83","documentation":"VaultFile.fromJson parses the on-disk vault JSON and enforces that the stored 'version' field is not newer than the VERSION constant this build of Aegis supports. If obj.getInt(\"version\") > VERSION it throws VaultFileException('unsupported version'), refusing to open a vault written by a newer app release to prevent silently mis-parsing future formats.","triggerScenarios":"Opening a vault file exported by a newer Aegis version (higher VERSION constant) in an older app build; restoring an old backup of the app alongside a newer vault file; downgrading the app after vault migration.","commonSituations":"User downgrades the APK or installs an older F-Droid build while their vault was written by a newer release; sync service restores a newer vault onto a device with an older app; enterprise managed rollout lag.","solutions":["Update Aegis to the latest version (a build whose VERSION >= the file's version) and retry unlocking","Open the vault file with the newer Aegis install it came from, re-export/downgrade the vault, then import here","Verify you are loading the intended vault file (an old backup vs the migrated one)","If unavoidable, file an issue to obtain a build that supports the format; never hand-edit the version field"],"exampleFix":"// before\nJSONObject obj = new JSONObject(vaultJson); // {\"version\": 3, ...} on app supporting 2\nVaultFile file = VaultFile.fromJson(obj); // VaultFileException: unsupported version\n// after\nJSONObject obj = new JSONObject(vaultJson);\nif (obj.optInt(\"version\", VaultFile.VERSION) > VaultFile.VERSION) {\n    promptUserToUpdateApp(); // offer newer release that supports the format\n} else {\n    VaultFile file = VaultFile.fromJson(obj);\n}","handlingStrategy":"try-catch","validationCode":"JSONObject obj = new JSONObject(vaultJson);\nif (obj.optInt(\"version\", Integer.MAX_VALUE) > VaultFile.VERSION) {\n    offerAppUpdate();\n    return;\n}","typeGuard":"boolean isReadableVaultVersion(JSONObject obj) {\n    return obj != null && obj.optInt(\"version\", Integer.MAX_VALUE) <= VaultFile.VERSION;\n}","tryCatchPattern":"try {\n    VaultFile vf = VaultFile.fromJson(obj);\n} catch (VaultFileException e) {\n    if (e.getMessage().contains(\"unsupported version\")) {\n        promptAppUpdateOrNewerAegis();\n    }\n}","preventionTips":["Keep the app updated before importing vault files from other devices","Never downgrade the app below the version that wrote the vault","Tag exported vault files with the producing app version for diagnostics"],"tags":["versioning","backward-compatibility","vault","android"],"backgroundTag":"unsupported-version","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}