{"record":{"id":"a6f4dc01d8589378","repo":"beemdevelopment/Aegis","slug":"unrecognized-tokentype-s","errorCode":null,"errorMessage":"Unrecognized tokenType: %s","messagePattern":"Unrecognized tokenType: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/importers/TwoFASImporter.java","lineNumber":199,"sourceCode":"                    issuer = info.optString(\"issuer\");\n                }\n                String name = info.optString(\"account\");\n                int digits = info.optInt(\"digits\", TotpInfo.DEFAULT_DIGITS);\n                String algorithm = info.optString(\"algorithm\", TotpInfo.DEFAULT_ALGORITHM);\n\n                OtpInfo otp;\n                String tokenType = JsonUtils.optString(info, \"tokenType\");\n                if (tokenType == null || tokenType.equals(\"TOTP\")) {\n                    int period = info.optInt(\"period\", TotpInfo.DEFAULT_PERIOD);\n                    otp = new TotpInfo(secret, algorithm, digits, period);\n                } else if (tokenType.equals(\"HOTP\")) {\n                    long counter = info.optLong(\"counter\", 0);\n                    otp = new HotpInfo(secret, algorithm, digits, counter);\n                } else if (tokenType.equals(\"STEAM\")) {\n                    int period = info.optInt(\"period\", TotpInfo.DEFAULT_PERIOD);\n                    otp = new SteamInfo(secret, algorithm, digits, period);\n                } else {\n                    throw new DatabaseImporterEntryException(String.format(\"Unrecognized tokenType: %s\", tokenType), obj.toString());\n                }\n\n                return new VaultEntry(otp, name, issuer);\n            } catch (OtpInfoException | JSONException | EncodingException e) {\n                throw new DatabaseImporterEntryException(e, obj.toString());\n            }\n        }\n    }\n}\n","sourceCodeStart":181,"sourceCodeEnd":209,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/importers/TwoFASImporter.java#L181-L209","documentation":"TwoFASImporter.convertEntry converts a 2FAS backup entry into an Aegis vault entry. It recognizes tokenType values TOTP, HOTP, and STEAM; any other tokenType string makes it throw DatabaseImporterEntryException, meaning the 2FAS backup contains a token type this importer doesn't know how to map.","triggerScenarios":"Importing a 2FAS backup JSON whose entry's tokenType is not exactly \"TOTP\", \"HOTP\", or \"STEAM\" — e.g. newer 2FAS app versions introducing new token types (like mobile OTP or service-specific types), or a manually edited backup.","commonSituations":"Users upgrading 2FAS to a version that writes new tokenType values, then importing the new backup into Aegis; hand-edited backups with inconsistent casing (\"totp\"); backups from beta 2FAS releases.","solutions":["Update Aegis to the latest version, which may support the new 2FAS tokenType.","Open the 2FAS backup and check the entry's tokenType value; re-create the token in 2FAS as a standard TOTP/HOTP and re-export.","Convert the token manually in Aegis by entering its secret and parameters (algorithm, digits, period).","If the type is legitimately supported by 2FAS, add an else-if branch in convertEntry mapping it to the correct OtpInfo subclass."],"exampleFix":"// before\n} else {\n    throw new DatabaseImporterEntryException(String.format(\"Unrecognized tokenType: %s\", tokenType), obj.toString());\n}\n// after: handle a new type instead of failing\n} else if (tokenType.equals(\"MOBILE_OTD\")) {\n    otp = new TotpInfo(secret, algorithm, digits, period);\n} else {\n    throw new DatabaseImporterEntryException(String.format(\"Unrecognized tokenType: %s\", tokenType), obj.toString());\n}","handlingStrategy":"validation","validationCode":"// Validate tokenType before conversion\nSet<String> supported = new HashSet<>(Arrays.asList(\"TOTP\", \"HOTP\", \"STEAM\"));\nString tokenType = info.optString(\"tokenType\", \"\");\nif (!supported.contains(tokenType)) {\n    reportSkippedEntry(obj, \"unsupported tokenType: \" + tokenType);\n}","typeGuard":"boolean isSupportedTokenType(String tokenType) {\n    return \"TOTP\".equals(tokenType) || \"HOTP\".equals(tokenType) || \"STEAM\".equals(tokenType);\n}","tryCatchPattern":"try {\n    entry = convertEntry(obj);\n} catch (DatabaseImporterEntryException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"Unrecognized tokenType\")) {\n        logSkippedEntry(obj, e.getMessage()); // skip entry, continue import\n    }\n}","preventionTips":["Inspect the 2FAS backup JSON for tokenType values before importing.","Update Aegis to the latest release when 2FAS adds new token types.","Re-create non-standard tokens in 2FAS as plain TOTP/HOTP and re-export.","Avoid hand-editing 2FAS backup files or changing value casing."],"tags":["importer","otp","unsupported-type"],"backgroundTag":"unsupported-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"}