{"record":{"id":"40642c54ad22a1b8","repo":"beemdevelopment/Aegis","slug":"unrecognized-slot-type","errorCode":null,"errorMessage":"unrecognized slot type","messagePattern":"unrecognized slot type","errorType":"exception","errorClass":"SlotException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/vault/slots/Slot.java","lineNumber":150,"sourceCode":"                case Slot.TYPE_RAW:\n                    slot = new RawSlot(uuid, key, keyParams);\n                    break;\n                case Slot.TYPE_PASSWORD:\n                    SCryptParameters scryptParams = new SCryptParameters(\n                            obj.getInt(\"n\"),\n                            obj.getInt(\"r\"),\n                            obj.getInt(\"p\"),\n                            Hex.decode(obj.getString(\"salt\"))\n                    );\n                    boolean repaired = obj.optBoolean(\"repaired\", false);\n                    boolean isBackup = obj.optBoolean(\"is_backup\", false);\n                    slot = new PasswordSlot(uuid, key, keyParams, scryptParams, repaired, isBackup);\n                    break;\n                case Slot.TYPE_BIOMETRIC:\n                    slot = new BiometricSlot(uuid, key, keyParams);\n                    break;\n                default:\n                    throw new SlotException(\"unrecognized slot type\");\n            }\n        } catch (JSONException | EncodingException e) {\n            throw new SlotException(e);\n        }\n\n        return slot;\n    }\n\n    public abstract byte getType();\n}\n","sourceCodeStart":132,"sourceCodeEnd":161,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/vault/slots/Slot.java#L132-L161","documentation":"Slot.fromJson reads the slot's 'type' integer from the vault JSON and instantiates the matching Slot subclass (Raw, Password, Biometric). Any type value not matching a known TYPE_* constant throws SlotException('unrecognized slot type'). This guards against corrupted vaults or vault files written by newer Aegis versions that introduced new slot types.","triggerScenarios":"Vault JSON contains a slot whose 'type' field is outside the known set (corruption, manual edit, or a newer app version's new slot type); the 'type' field is missing/garbled so getInt returns a wrong value.","commonSituations":"Restoring a vault from a newer Aegis onto an older build; partial/failed vault export or truncated copy; user-edited or third-party-processed vault files; bit rot in backups.","solutions":["Open the vault with the same or newer Aegis version that wrote it (update the app)","Re-export the vault from a working installation and verify it unlocks there before transferring","Restore an earlier known-good vault backup; discard the corrupted one","Check that any vault-processing scripts preserved the integer 'type' field exactly"],"exampleFix":"// before\n// slot JSON: {\"type\": 99, \"uuid\": ...} from newer app version\nSlot slot = Slot.fromJson(obj); // SlotException: unrecognized slot type\n// after\nint type = obj.getInt(\"type\");\nif (type > Slot.TYPE_BIOMETRIC) {\n    notifyUserToUpdateApp(); // newer slot type needs newer build\n} else {\n    Slot slot = Slot.fromJson(obj);\n}","handlingStrategy":"validation","validationCode":"int type = obj.optInt(\"type\", -1);\nboolean known = type == Slot.TYPE_RAW || type == Slot.TYPE_PASSWORD || type == Slot.TYPE_BIOMETRIC;\nif (!known) { promptAppUpdateOrRejectVault(); }","typeGuard":"boolean isKnownSlotType(JSONObject slotObj) {\n    int t = slotObj.optInt(\"type\", -1);\n    return t == Slot.TYPE_RAW || t == Slot.TYPE_PASSWORD || t == Slot.TYPE_BIOMETRIC;\n}","tryCatchPattern":"try {\n    Slot slot = Slot.fromJson(obj);\n} catch (SlotException e) {\n    if (e.getMessage().contains(\"unrecognized slot type\")) {\n        suggestNewerAegisVersion();\n    }\n}","preventionTips":["Never hand-edit vault slot JSON; transfer exports verbatim","Move vaults only between same-or-newer Aegis versions","Keep verified backups so a corrupted export can be replaced"],"tags":["vault","slots","versioning","android"],"backgroundTag":"invalid-enum-value","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"}