{"record":{"id":"e40136660a71aa87","repo":"beemdevelopment/Aegis","slug":"pin-is-a-required-field-must-have-a-minimum-lengt","errorCode":null,"errorMessage":"PIN is a required field. Must have a minimum length of 4 digits.","messagePattern":"PIN is a required field\\. Must have a minimum length of 4 digits\\.","errorType":"validation","errorClass":"ParseException","httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/ui/EditEntryActivity.java","lineNumber":729,"sourceCode":"            return Integer.parseInt(_textPeriodCounter.getText().toString());\n        } catch (NumberFormatException e) {\n            throw new ParseException(\"Period is not an integer.\");\n        }\n    }\n\n    private VaultEntry parseEntry() throws ParseException {\n        if (_textSecret.length() == 0) {\n            throw new ParseException(\"Secret is a required field.\");\n        }\n\n        String type = _dropdownType.getText().toString();\n        String algo = _dropdownAlgo.getText().toString();\n        String lowerCasedType = type.toLowerCase(Locale.ROOT);\n\n        if (lowerCasedType.equals(YandexInfo.ID) || lowerCasedType.equals(MotpInfo.ID)) {\n            int pinLength = _textPin.length();\n            if (pinLength < 4) {\n                throw new ParseException(\"PIN is a required field. Must have a minimum length of 4 digits.\");\n            }\n            if (pinLength != 4 && lowerCasedType.equals(MotpInfo.ID)) {\n                throw new ParseException(\"PIN must have a length of 4 digits.\");\n            }\n        }\n\n        int digits;\n        try {\n            digits = Integer.parseInt(_textDigits.getText().toString());\n        } catch (NumberFormatException e) {\n            throw new ParseException(\"Digits is not an integer.\");\n        }\n\n        byte[] secret;\n        try {\n            String secretString = new String(EditTextHelper.getEditTextChars(_textSecret));\n\n            secret = (lowerCasedType.equals(MotpInfo.ID)) ?","sourceCodeStart":711,"sourceCodeEnd":747,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/ui/EditEntryActivity.java#L711-L747","documentation":"When the entry type is Yandex or MOTP, EditEntryActivity.parseEntry() requires a PIN of at least 4 characters. This ParseException is thrown when the PIN field is shorter than 4 characters, because both Yandex and MOTP OTP schemes mandate a minimum 4-digit PIN to derive the OTP.","triggerScenarios":"Saving an entry whose lower-cased type equals YandexInfo.ID or MotpInfo.ID while _textPin has length < 4 (empty or 1-3 characters).","commonSituations":"Setting up a Yandex or MOTP entry and leaving the PIN field empty or entering a short PIN (e.g. '123'), or pasting a truncated PIN.","solutions":["Enter a PIN of at least 4 digits in the PIN field before saving","For MOTP, enter exactly 4 digits (a 5+ digit PIN triggers the next check)","Re-check the PIN issued by your provider and paste it in full"],"exampleFix":"// before\npinField.setText(\"12\");\n// after\npinField.setText(\"1234\");","handlingStrategy":"validation","validationCode":"if (type is Yandex or MOTP && _textPin.length() < 4) {\n    _textPinLayout.setError(\"PIN must be at least 4 digits\");\n    return;\n}","typeGuard":null,"tryCatchPattern":"try {\n    saveEntry();\n} catch (ParseException e) {\n    if (e.getMessage() != null && e.getMessage().startsWith(\"PIN is a required field\")) {\n        _textPinLayout.setError(\"PIN must be at least 4 digits\");\n    }\n}","preventionTips":["Use inputType=\"numberPassword\" with minLength enforcement on the PIN field","Only show/require the PIN field for Yandex/MOTP types","Validate PIN length in a TextWatcher before allowing save"],"tags":["android","validation","otp","pin-length"],"backgroundTag":"invalid-argument-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"}