{"record":{"id":"61b94a4c8e999438","repo":"beemdevelopment/Aegis","slug":"parameter-counter-is-not-present","errorCode":null,"errorMessage":"Parameter 'counter' is not present","messagePattern":"Parameter 'counter' is not present","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":95,"sourceCode":"                    String period = uri.getQueryParameter(\"period\");\n                    if (period != null) {\n                        totpInfo.setPeriod(Integer.parseInt(period));\n                    }\n                    info = totpInfo;\n                    break;\n                case \"steam\":\n                    SteamInfo steamInfo = new SteamInfo(secret);\n                    period = uri.getQueryParameter(\"period\");\n                    if (period != null) {\n                        steamInfo.setPeriod(Integer.parseInt(period));\n                    }\n                    info = steamInfo;\n                    break;\n                case \"hotp\":\n                    HotpInfo hotpInfo = new HotpInfo(secret);\n                    String counter = uri.getQueryParameter(\"counter\");\n                    if (counter == null) {\n                        throw new GoogleAuthInfoException(uri, \"Parameter 'counter' is not present\");\n                    }\n                    hotpInfo.setCounter(Long.parseLong(counter));\n                    info = hotpInfo;\n                    break;\n                case YandexInfo.HOST_ID:\n                    String pin = uri.getQueryParameter(\"pin\");\n                    if (pin != null) {\n                        pin = new String(parseSecret(pin), StandardCharsets.UTF_8);\n                    }\n\n                    info = new YandexInfo(secret, pin);\n                    issuer = info.getType();\n                    break;\n                case MotpInfo.ID:\n                    info = new MotpInfo(secret);\n                    break;\n                default:\n                    throw new GoogleAuthInfoException(uri, String.format(\"Unsupported OTP type: %s\", type));","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L77-L113","documentation":"Thrown by GoogleAuthInfo.parseUri(Uri) when a hotp-type URI lacks the required 'counter' query parameter. HOTP needs an initial counter value to derive codes; without it the OtpInfo cannot be initialized, so parsing aborts. It fires on otpauth://hotp URIs missing &counter=N.","triggerScenarios":"parseUri(Uri) encountering otpauth://hotp/label?secret=... without counter=.","commonSituations":"QR generators defaulting to TOTP-style parameters for a HOTP secret, manually migrating a HOTP entry and forgetting the counter, or provider docs assuming the counter is optional.","solutions":["Add &counter=N (initial counter, usually 0) to the otpauth://hotp URI","Ensure the exporting service includes the counter for HOTP entries","If the token is actually time-based, use otpauth://totp instead"],"exampleFix":"// before\nString uri = \"otpauth://hotp/x?secret=JBSWY3DPEHPK3PXP\";\n// after\nString uri = \"otpauth://hotp/x?secret=JBSWY3DPEHPK3PXP&counter=0\";","handlingStrategy":"validation","validationCode":"if (uri.getHost().equals(\"hotp\") && uri.getQueryParameter(\"counter\") == null) throw new IllegalArgumentException(\"hotp URI missing counter\");","typeGuard":null,"tryCatchPattern":"try { return GoogleAuthInfo.parseUri(uri); } catch (GoogleAuthInfoException e) { askUserForCounter(uri); return null; }","preventionTips":["Include counter=0 (or actual value) in every otpauth://hotp URI","Confirm OTP type before import: hotp requires counter, totp does not","When migrating tokens, carry over the counter value"],"tags":["android","otp","hotp","missing-parameter"],"backgroundTag":"missing-required-argument","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"}