MuntashirAkon/AppManager · warning · java.io.IOException

Invalid SSAID ${length}

Error message

Invalid SSAID ${length}

What it means

IOException thrown when the SSAID passes the length check but contains characters outside [0-9A-Fa-f], i.e. it is not a valid hexadecimal string. SSAIDs must be pure hex, so the dialog rejects the value before calling SsaidSettings.setSsaid.

Source

Thrown at app/src/main/java/io/github/muntashirakon/AppManager/ssaid/ChangeSsaidDialog.java:104

        AtomicReference<Button> resetButton = new AtomicReference<>();

        alertDialog.setOnShowListener(dialog -> {
            applyButton.set(alertDialog.getButton(AlertDialog.BUTTON_POSITIVE));
            resetButton.set(alertDialog.getButton(AlertDialog.BUTTON_NEUTRAL));
            applyButton.get().setVisibility(View.GONE);
            applyButton.get().setOnClickListener(v -> {
                mSsaidChangedResult = ThreadUtils.postOnBackgroundThread(() -> {
                    try {
                        Editable editable = ssaidEditText.getText();
                        if (editable == null) {
                            throw new IOException("Empty SSAID field.");
                        }
                        mSsaid = editable.toString();
                        if (mSsaid.length() != sizeByte * 2) {
                            throw new IOException("Invalid SSAID size " + mSsaid.length());
                        }
                        if (!mSsaid.matches("[0-9A-Fa-f]+")) {
                            throw new IOException("Invalid SSAID " + mSsaid.length());
                        }
                        SsaidSettings ssaidSettings = new SsaidSettings(UserHandleHidden.getUserId(uid));
                        boolean isSuccess = ssaidSettings.setSsaid(packageName, uid, mSsaid);
                        if (isSuccess) {
                            alertDialog.dismiss();
                        }
                        if (mSsaidChangedInterface != null) {
                            ThreadUtils.postOnMainThread(() -> mSsaidChangedInterface.onSsaidChanged(mSsaid, isSuccess));
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                        if (mSsaidChangedInterface != null) {
                            ThreadUtils.postOnMainThread(() -> mSsaidChangedInterface.onSsaidChanged(mSsaid, false));
                        }
                    }
                });
            });
            resetButton.get().setVisibility(View.GONE);

View on GitHub (pinned to 0152f468fc)

Solutions

  1. Strip non-hex characters (hyphens, spaces, 0x prefix) from the input before validation
  2. Use an InputFilter/KeyListener restricting the EditText to hex characters
  3. Normalize the input to uppercase and trim before the regex check
  4. Catch the IOException and show a 'value must be hexadecimal' message

Example fix

// before
if (!mSsaid.matches("[0-9A-Fa-f]+")) {
    throw new IOException("Invalid SSAID " + mSsaid.length());
}
// after
mSsaid = mSsaid.replaceFirst("^0x", "").replaceAll("[-\\s]", "").toUpperCase(Locale.US);
if (!mSsaid.matches("[0-9A-F]+")) {
    ssaidEditText.setError(getContext().getString(R.string.ssaid_must_be_hex));
    return null;
}
Defensive patterns

Strategy: validation

Validate before calling

String text = ssaidEditText.getText().toString().trim().replaceFirst("^0x", "").replaceAll("[-\\s]", "");
if (!text.matches("[0-9A-Fa-f]+")) {
    ssaidEditText.setError("SSAID must be hexadecimal");
    return;
}

Type guard

boolean isHex(String s) { return s != null && !s.isEmpty() && s.chars().allMatch(c -> Character.digit(c, 16) >= 0); }

Try / catch

try {
    applySsaid();
} catch (IOException e) {
    ssaidEditText.setError(context.getString(R.string.ssaid_must_be_hex));
}

Prevention

When it happens

Trigger: Entering a SSAID containing letters outside A-F (e.g. G-Z), digits with '0x' prefix, spaces, hyphens, or other punctuation; mSsaid.matches("[0-9A-Fa-f]+") fails and the error is thrown with the invalid length as detail.

Common situations: Pasting a UUID with hyphens; copying an identifier with surrounding text; user typing 'O' instead of '0' or including a '0x' prefix from a debugger view.

Understand the failure class

Background: "invalid id" errors: invalid identifier format — why libraries reject IDs before lookup, and how to fix them — this error's family across 37 libraries.

Related errors


AI-assisted analysis of MuntashirAkon/AppManager@0152f468fc (2026-09-12). Data as JSON: /api/errors/cde71014d5cd8407. Report an issue: GitHub.