beemdevelopment/Aegis · error · ParseException

Period is not an integer.

Error message

Period is not an integer.

What it means

EditEntryActivity.parsePeriod() parses the period/counter field of an OTP entry with Integer.parseInt and wraps any NumberFormatException in a ParseException. Aegis throws this when the user saves an entry whose HOTP counter or custom period field is empty or contains non-numeric text, since a non-integer period cannot be used to construct a valid TotpInfo/HotpInfo.

Solutions

  1. Enter a plain integer value (e.g. 30 for TOTP period or a valid HOTP counter) in the period/counter field before saving
  2. Clear the field and retype the value to remove invisible characters or stray whitespace
  3. Restore the entry's original period/counter value if you did not intend to change it

Example fix

// before
counterField.setText("30s");
// after
counterField.setText("30");
Defensive patterns

Strategy: validation

Validate before calling

String period = textPeriodCounter.getText().toString().trim();
if (!period.matches("\\d+")) {
    // show input error before calling save
}

Try / catch

try {
    saveEntry();
} catch (ParseException e) {
    if ("Period is not an integer.".equals(e.getMessage())) {
        _textPeriodCounterLayout.setError("Enter a whole number");
    }
}

Prevention

When it happens

Trigger: Saving an edited TOTP/HOTP entry while the 'Period' (counter) text field is empty, contains letters, spaces, decimal points, or other non-integer characters; Integer.parseInt throws NumberFormatException which is rethrown as ParseException.

Common situations: Users accidentally typing characters into the period/counter field, clearing the field before saving, or pasting formatted values like '30s' or '30.0' into the field when editing advanced OTP settings.

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/d584d343fc031e17. Report an issue: GitHub.

Appendix: source

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

        saveAndFinish(entry, true);
    }

    private void saveAndFinish(VaultEntry entry, boolean delete) {
        Intent intent = new Intent();
        intent.putExtra("entryUUID", entry.getUUID());
        intent.putExtra("delete", delete);

        if (saveAndBackupVault()) {
            setResult(RESULT_OK, intent);
            finish();
        }
    }

    private int parsePeriod() throws ParseException {
        try {
            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)) {

View on GitHub (pinned to d6f4e5925a)