{"record":{"id":"4e8c7a5cdc5d5be5","repo":"beemdevelopment/Aegis","slug":"unsupported-number-of-digits-s","errorCode":null,"errorMessage":"Unsupported number of digits: %s","messagePattern":"Unsupported number of digits: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":437,"sourceCode":"                    case \"SHA512\":\n                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_SHA512);\n                        break;\n                    case \"MD5\":\n                        parameters.setAlgorithm(GoogleAuthProtos.MigrationPayload.Algorithm.ALGORITHM_MD5);\n                        break;\n                    default:\n                        throw new GoogleAuthInfoException(info.getUri(), String.format(\"Unsupported Algorithm: %s\", info.getOtpInfo().getAlgorithm(false)));\n                }\n\n                switch (info.getOtpInfo().getDigits()) {\n                    case 6:\n                        parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_SIX);\n                        break;\n                    case 8:\n                        parameters.setDigits(GoogleAuthProtos.MigrationPayload.DigitCount.DIGIT_COUNT_EIGHT);\n                        break;\n                    default:\n                        throw new GoogleAuthInfoException(info.getUri(), String.format(\"Unsupported number of digits: %s\", info.getOtpInfo().getDigits()));\n                }\n\n                switch (info.getOtpInfo().getType().toLowerCase()) {\n                    case HotpInfo.ID:\n                        parameters.setType(GoogleAuthProtos.MigrationPayload.OtpType.OTP_TYPE_HOTP);\n                        parameters.setCounter(((HotpInfo) info.getOtpInfo()).getCounter());\n                        break;\n                    case TotpInfo.ID:\n                        parameters.setType(GoogleAuthProtos.MigrationPayload.OtpType.OTP_TYPE_TOTP);\n                        break;\n                    default:\n                        throw new GoogleAuthInfoException(info.getUri(), String.format(\"Type unsupported by GoogleAuthProtos: %s\", info.getOtpInfo().getType()));\n                }\n\n                builder.addOtpParameters(parameters.build());\n            }\n\n            Uri.Builder exportUriBuilder = new Uri.Builder()","sourceCodeStart":419,"sourceCodeEnd":455,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L419-L455","documentation":"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.","triggerScenarios":"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).","commonSituations":"Custom tokens configured with unusual digit counts in Aegis, or fork-defined token types with non-standard code lengths.","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"],"exampleFix":"// before\nTotpInfo info = new TotpInfo(secret, \"SHA1\", 7, 30); // then export\n// after\nTotpInfo info = new TotpInfo(secret, \"SHA1\", 6, 30); // then export","handlingStrategy":"validation","validationCode":"int d = entry.getInfo().getDigits();\nif (d != 6 && d != 8) { /* skip or warn */ }","typeGuard":null,"tryCatchPattern":"try {\n    uri = GoogleAuthInfo.getUri(entry);\n} catch (GoogleAuthInfoException e) {\n    skipped.add(entry); // unsupported digit count for Google export\n}","preventionTips":["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"],"tags":["otp","digits","export"],"backgroundTag":"value-out-of-range","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"}