beemdevelopment/Aegis · error · ParseException

Digits is not an integer.

Error message

Digits is not an integer.

What it means

EditEntryActivity.parseEntry() parses the digits field with Integer.parseInt and wraps NumberFormatException in a ParseException. Aegis throws this when the number-of-digits field for the OTP code is empty or non-numeric, because the code length must be an integer to configure the OtpInfo.

Solutions

  1. Enter a plain integer (commonly 6 or 8) in the Digits field before saving
  2. Retype the value to remove stray whitespace or hidden characters
  3. Restore the provider's documented code length (usually 6)

Example fix

// before
digitsField.setText("6.0");
// after
digitsField.setText("6");
Defensive patterns

Strategy: validation

Validate before calling

String digits = _textDigits.getText().toString().trim();
if (!digits.matches("\\d+")) {
    _textDigitsLayout.setError("Enter a whole number");
    return;
}

Try / catch

try {
    saveEntry();
} catch (ParseException e) {
    if ("Digits is not an integer.".equals(e.getMessage())) {
        _textDigitsLayout.setError("Digits must be a whole number");
    }
}

Prevention

When it happens

Trigger: Saving an entry while the 'Digits' text field is empty, contains letters, decimal values like '6.0', or whitespace; Integer.parseInt throws NumberFormatException.

Common situations: Users experimenting with advanced settings clearing the digits field, or pasting values such as 'six' or '6 ' into it.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


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

Appendix: source

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

        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)) ?
                    Hex.decode(secretString) : GoogleAuthInfo.parseSecret(secretString);

            if (secret.length == 0) {
                throw new ParseException("Secret cannot be empty");
            }
        } catch (EncodingException e) {
            String exceptionMessage = (lowerCasedType.equals(MotpInfo.ID)) ?
                    "Secret is not valid hexadecimal" : "Secret is not valid base32.";

            throw new ParseException(exceptionMessage);
        }

View on GitHub (pinned to d6f4e5925a)