beemdevelopment/Aegis · error
Unsupported number of digits
Error message
Unsupported number of digits: %s
What it means
When encoding to a migration payload, getUri maps the OtpInfo's digit count to the protobuf DigitCount enum, which only defines 6 and 8 (with 7 commonly accepted as unspecified). Digit counts outside {6, 8} cannot be represented and throw a GoogleAuthInfoException.
Solutions
- Change the token's digit count to 6 or 8 before exporting
- Skip entries with unsupported digit counts during export
- Extend the switch to map other digit counts if acceptable for the payload
Example fix
// before TotpInfo info = new TotpInfo(secret, "SHA1", 7, 30); // then export // after TotpInfo info = new TotpInfo(secret, "SHA1", 6, 30); // then export
Defensive patterns
Strategy: validation
Validate before calling
int d = entry.getInfo().getDigits();
if (d != 6 && d != 8) { /* skip or warn */ } Try / catch
try {
uri = GoogleAuthInfo.getUri(entry);
} catch (GoogleAuthInfoException e) {
skipped.add(entry); // unsupported digit count for Google export
} Prevention
- Configure tokens with 6 or 8 digits
- Warn users at token creation about export compatibility
- Catch per entry to keep the rest of the export intact
When it happens
Trigger: Calling GoogleAuthInfo.getUri (via export/exportGoogleUris) on an entry whose getOtpInfo().getDigits() is not 6 or 8 (e.g. 5, 7, 9, 10-digit tokens).
Common situations: Custom tokens configured with unusual digit counts in Aegis, or fork-defined token types with non-standard code lengths.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- Bad URI format
- Unsupported protocol
- Export list contains entries from different batches
- Unsupported Algorithm
- Type unsupported by GoogleAuthProtos
AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08).
Data as JSON: /api/errors/4e8c7a5cdc5d5be5.
Report an issue: GitHub.
Appendix: source
Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java:437
case "SHA512":
parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA512);
break;
case "MD5":
parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_MD5);
break;
default:
throw new GoogleAuthInfoException(info.getUri(), String.format("Unsupported Algorithm: %s", info.getOtpInfo().getAlgorithm(false)));
}
switch (info.getOtpInfo().getDigits()) {
case 6:
parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_SIX);
break;
case 8:
parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_EIGHT);
break;
default:
throw new GoogleAuthInfoException(info.getUri(), String.format("Unsupported number of digits: %s", info.getOtpInfo().getDigits()));
}
switch (info.getOtpInfo().getType().toLowerCase()) {
case HotpInfo.ID:
parameters.setType(GoogleAuthProtos.MigrationPayload.OtpType.OTP_TYPE_HOTP);
parameters.setCounter(((HotpInfo) info.getOtpInfo()).getCounter());
break;
case TotpInfo.ID:
parameters.setType(GoogleAuthProtos.MigrationPayload.OtpType.OTP_TYPE_TOTP);
break;
default:
throw new GoogleAuthInfoException(info.getUri(), String.format("Type unsupported by GoogleAuthProtos: %s", info.getOtpInfo().getType()));
}
builder.addOtpParameters(parameters.build());
}
Uri.Builder exportUriBuilder = new Uri.Builder()View on GitHub (pinned to d6f4e5925a)