beemdevelopment/Aegis · error · OtpInfoException
unsupported otp type:
Error message
unsupported otp type:
What it means
OtpInfo.fromJson dispatches on the OTP type string (TOTP, HOTP, Steam, Yandex, Motp, etc.) and throws when the stored type is not one of the supported constants. It happens while deserializing an entry from JSON (vault or import).
Solutions
- Update Aegis to the latest version so all supported otp types are recognized
- Inspect the entry's JSON 'type' field and correct it to a supported value (TOTP, HOTP, STEAM, YANDEX, MOTP)
- Check for typos/case mismatches in the type string before calling fromJson
- Wrap fromJson in try-catch on OtpInfoException and skip/handle the unrecognized entry instead of failing the whole import
Example fix
// before
OtpInfo info = OtpInfo.fromJson(obj.getString("type"), obj); // throws for unknown type
// after
String type = obj.optString("type", "");
if (type.isEmpty() || !SUPPORTED_TYPES.contains(type)) {
Log.w(TAG, "Skipping entry with unsupported type: " + type);
return null;
}
OtpInfo info = OtpInfo.fromJson(type, obj); Defensive patterns
Strategy: try-catch
Validate before calling
Set<String> supported = Set.of(TotpInfo.ID, HotpInfo.ID, SteamInfo.ID, YandexInfo.ID, MotpInfo.ID);
if (!supported.contains(type)) {
Log.w(TAG, "Unsupported OTP type: " + type);
return null;
} Type guard
boolean isSupportedOtpType(String t) {
return TotpInfo.ID.equals(t) || HotpInfo.ID.equals(t)
|| SteamInfo.ID.equals(t) || YandexInfo.ID.equals(t) || MotpInfo.ID.equals(t);
} Try / catch
try {
return OtpInfo.fromJson(type, obj);
} catch (OtpInfoException e) {
Log.w(TAG, "Skipping entry with unsupported type: " + type, e);
return null;
} Prevention
- Keep Aegis updated before importing vaults from newer versions
- Validate the 'type' field against known IDs before deserialization
- Handle unknown entries gracefully instead of aborting the whole import
- Never hand-edit vault JSON type fields without verifying accepted values
When it happens
Trigger: Deserializing an entry whose JSON 'type' field is absent, misspelled, or from a newer/older Aegis version supporting types this build does not know; calling OtpInfo.fromJson(type, obj) directly with an unknown type.
Common situations: Importing vaults or backups from other apps or newer Aegis versions, manually edited vault JSON with a typo in 'type', downgraded Aegis build opening a vault created by a newer version.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Unsupported OTP type
- unsupported otp type:
- unsupported otp type:
- unsupported otp type:
- Unrecognized tokenType
AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08).
Data as JSON: /api/errors/e35a894a35736898.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/OtpInfo.java:138
switch (type) {
case TotpInfo.ID:
info = new TotpInfo(secret, algo, digits, obj.getInt("period"));
break;
case SteamInfo.ID:
info = new SteamInfo(secret, algo, digits, obj.getInt("period"));
break;
case HotpInfo.ID:
info = new HotpInfo(secret, algo, digits, obj.getLong("counter"));
break;
case YandexInfo.ID:
info = new YandexInfo(secret, obj.getString("pin"));
break;
case MotpInfo.ID:
info = new MotpInfo(secret, obj.getString("pin"));
break;
default:
throw new OtpInfoException("unsupported otp type: " + type);
}
} catch (EncodingException | JSONException e) {
throw new OtpInfoException(e);
}
return info;
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (!(o instanceof OtpInfo)) {
return false;
}
OtpInfo info = (OtpInfo) o;View on GitHub (pinned to d6f4e5925a)