beemdevelopment/Aegis · error · ParseException

PIN is a required field. Must have a minimum length of 4…

Error message

PIN is a required field. Must have a minimum length of 4 digits.

What it means

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.

Solutions

  1. Enter a PIN of at least 4 digits in the PIN field before saving
  2. For MOTP, enter exactly 4 digits (a 5+ digit PIN triggers the next check)
  3. Re-check the PIN issued by your provider and paste it in full

Example fix

// before
pinField.setText("12");
// after
pinField.setText("1234");
Defensive patterns

Strategy: validation

Validate before calling

if (type is Yandex or MOTP && _textPin.length() < 4) {
    _textPinLayout.setError("PIN must be at least 4 digits");
    return;
}

Try / catch

try {
    saveEntry();
} catch (ParseException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("PIN is a required field")) {
        _textPinLayout.setError("PIN must be at least 4 digits");
    }
}

Prevention

When it happens

Trigger: Saving an entry whose lower-cased type equals YandexInfo.ID or MotpInfo.ID while _textPin has length < 4 (empty or 1-3 characters).

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of beemdevelopment/Aegis@d6f4e5925a (2026-09-08). Data as JSON: /api/errors/e40136660a71aa87. Report an issue: GitHub.

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/ui/EditEntryActivity.java:729

            return Integer.parseInt(_textPeriodCounter.getText().toString());
        } catch (NumberFormatException e) {
            throw new ParseException("Period is not an integer.");
        }
    }

    private VaultEntry parseEntry() throws ParseException {
        if (_textSecret.length() == 0) {
            throw new ParseException("Secret is a required field.");
        }

        String type = _dropdownType.getText().toString();
        String algo = _dropdownAlgo.getText().toString();
        String lowerCasedType = type.toLowerCase(Locale.ROOT);

        if (lowerCasedType.equals(YandexInfo.ID) || lowerCasedType.equals(MotpInfo.ID)) {
            int pinLength = _textPin.length();
            if (pinLength < 4) {
                throw new ParseException("PIN is a required field. Must have a minimum length of 4 digits.");
            }
            if (pinLength != 4 && lowerCasedType.equals(MotpInfo.ID)) {
                throw new ParseException("PIN must have a length of 4 digits.");
            }
        }

        int digits;
        try {
            digits = Integer.parseInt(_textDigits.getText().toString());
        } catch (NumberFormatException e) {
            throw new ParseException("Digits is not an integer.");
        }

        byte[] secret;
        try {
            String secretString = new String(EditTextHelper.getEditTextChars(_textSecret));

            secret = (lowerCasedType.equals(MotpInfo.ID)) ?

View on GitHub (pinned to d6f4e5925a)