{"record":{"id":"f343dfc1735fa7bb","repo":"beemdevelopment/Aegis","slug":"unexpected-field-type-s","errorCode":null,"errorMessage":"Unexpected field type: %s","messagePattern":"Unexpected field type: (.+?)","errorType":"exception","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/importers/FreeOtpImporter.java","lineNumber":435,"sourceCode":"            }\n\n            // Read past all of the fields in the class\n            byte fieldDescriptor = inputStream.readByte();\n            if (fieldDescriptor == TC_NULL) {\n                return;\n            }\n            int totalFieldSkip = 0;\n            int fieldCount = inputStream.readUnsignedShort();\n            for (int i = 0; i < fieldCount; i++) {\n                char fieldType = (char) inputStream.readByte();\n                parseUTF(inputStream);\n                switch (fieldType) {\n                    case 'F': // float (4 bytes)\n                    case 'I': // int (4 bytes)\n                        totalFieldSkip += 4;\n                        break;\n                    default:\n                        throw new ParseException(String.format(\"Unexpected field type: %s\", fieldType));\n                }\n            }\n            inputStream.skipBytes(totalFieldSkip);\n\n            // Not sure what these bytes are, just skip them\n            inputStream.skipBytes(4);\n        }\n\n        private static String parseStringObject(DataInputStream inputStream)\n                throws IOException, ParseException {\n            byte objectType = inputStream.readByte();\n            if (objectType != TC_STRING) {\n                throw new ParseException(String.format(\"Expected a string object, found: %d\", objectType));\n            }\n\n            int length = inputStream.readUnsignedShort();\n            byte[] strBytes = new byte[length];\n            inputStream.readFully(strBytes);","sourceCodeStart":417,"sourceCodeEnd":453,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/importers/FreeOtpImporter.java#L417-L453","documentation":"While skipping the field descriptors of the serialized HashMap class, parseClassDescriptor recognizes only primitive field type codes it knows ('F' float, 'I' int, plus other handled cases above the shown snippet). An unknown Java serialization field type code means the class descriptor layout differs from what FreeOTP is expected to write, so parsing aborts.","triggerScenarios":"A FreeOTP backup whose serialized HashMap class declares a field with a type code the skip-logic doesn't handle (e.g. arrays, objects, doubles, longs not covered by the switch), indicating a different producing app/version.","commonSituations":"Importing backups from FreeOTP forks that added fields to the stored map; importing a non-FreeOTP Java-serialized file; a corrupted stream where the field descriptor byte is garbage.","solutions":["Re-export the tokens using the stock FreeOTP app so the class descriptor matches the expected layout.","Confirm the file is a genuine FreeOTP backup and not another app's serialized data.","Extend the switch in parseClassDescriptor to handle the additional field type codes (e.g. 'J' long, 'D' double, 'Z' boolean) with correct byte widths.","Inspect the stream with a Java serialization dumper to identify the unexpected field type."],"exampleFix":"// before\ndefault:\n    throw new ParseException(String.format(\"Unexpected field type: %s\", fieldType));\n// after\ncase 'J': // long (8 bytes)\n    totalFieldSkip += 8;\n    break;\ncase 'D': // double (8 bytes)\n    totalFieldSkip += 8;\n    break;\ndefault:\n    throw new ParseException(String.format(\"Unexpected field type: %s\", fieldType));","handlingStrategy":"try-catch","validationCode":"// Confirm the source is stock FreeOTP before import\nboolean isKnownSource = backupMetadata.getString(\"producer\", \"\").equals(\"FreeOTP\");\nif (!isKnownSource) throw new IllegalArgumentException(\"Unsupported backup producer\");","typeGuard":null,"tryCatchPattern":"try {\n    importer.importFromUri(uri);\n} catch (DatabaseImporterException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Unexpected field type\")) {\n        showError(\"Backup contains fields this importer doesn't support; update Aegis or re-export from stock FreeOTP.\");\n    }\n}","preventionTips":["Re-export from the stock FreeOTP app rather than forks or modified builds.","Update Aegis before importing so newer field layouts are handled.","Inspect unknown files with a Java serialization dumper first.","Avoid hand-editing serialized backups."],"tags":["java-serialization","importer","format-mismatch"],"backgroundTag":"incompatible-source-type","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"}