beemdevelopment/Aegis · error · VaultException

Unsupported version

Error message

Unsupported version

What it means

Vault.fromJson throws VaultException when the serialized vault's "version" field is greater than the VERSION this app build supports. This is a forward-compatibility guard: a vault written by a newer Aegis version must not be loaded, since downgrading could silently drop or misinterpret newer data. It fires when a user restores a backup or migrates a vault from a newer app release.

Solutions

  1. Catch the VaultException for unsupported version and show a dialog telling the user the vault was created by a newer Aegis version
  2. Check obj.getInt("version") against Vault.VERSION before parsing and throw a dedicated VaultVersionException with the found and supported versions
  3. Refuse to import/export across incompatible versions and direct users to update the app before opening the vault
  4. Add a migration path when a newer schema is intentionally supported, bumping VERSION and converting old fields
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at app/src/main/java/com/beemdevelopment/aegis/vault/Vault.java:62 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/2efe3c8e4716ac55. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/vault/Vault.java:62

            obj.put("entries", entriesArray);
            obj.put("groups", groupsArray);
            obj.put("icons_optimized", _iconsOptimized);

            return obj;
        } catch (JSONException e) {
            throw new RuntimeException(e);
        }
    }

    public static Vault fromJson(JSONObject obj) throws VaultException {
        Vault vault = new Vault();
        UUIDMap<VaultEntry> entries = vault.getEntries();
        UUIDMap<VaultGroup> groups = vault.getGroups();

        try {
            int ver = obj.getInt("version");
            if (ver > VERSION) {
                throw new VaultException("Unsupported version");
            }

            if (obj.has("groups")) {
                JSONArray groupsArray = obj.getJSONArray("groups");
                for (int i = 0; i < groupsArray.length(); i++) {
                    VaultGroup group = VaultGroup.fromJson(groupsArray.getJSONObject(i));
                    if (!groups.has(group)) {
                        groups.add(group);
                    }
                }
            }

            JSONArray array = obj.getJSONArray("entries");
            for (int i = 0; i < array.length(); i++) {
                VaultEntry entry = VaultEntry.fromJson(array.getJSONObject(i));
                if (vault.migrateOldGroup(entry)) {
                    vault.setGroupsMigrationFresh();
                }

View on GitHub (pinned to d6f4e5925a)