beemdevelopment/Aegis · error

Unsupported protocol

Error message

Unsupported protocol

What it means

Generic guard in parseExportUri(Uri): thrown when the parsed export URI's scheme is not an accepted value (e.g. content:// or file://). It fires when a user selects a source Android cannot handle for exports/imports, and signals the URI does not point at readable local content.

Solutions

  1. Ensure the input URI uses the Aegis export scheme (GoogleAuthInfo.SCHEME_EXPORT)
  2. Route regular otpauth:// URIs to GoogleAuthInfo.parseUri instead of parseExportUri
  3. Check the intent filter/mime handling so only export URIs reach this parser

Example fix

// before
Uri uri = Uri.parse(exportText);
GoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(uri);
// after
Uri uri = Uri.parse(exportText);
if (uri.getScheme() != null && uri.getScheme().equals(GoogleAuthInfo.SCHEME_EXPORT)) {
    GoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(uri);
} else {
    GoogleAuthInfo info = GoogleAuthInfo.parseUri(uri); // single-entry URI path
}
Defensive patterns

Strategy: validation

Validate before calling

Uri uri = Uri.parse(s); if (!GoogleAuthInfo.SCHEME_EXPORT.equals(uri.getScheme())) return null;

Type guard

boolean isExportUri(Uri u) { return GoogleAuthInfo.SCHEME_EXPORT.equals(u.getScheme()); }

Try / catch

try { return GoogleAuthInfo.parseExportUri(uri); } catch (GoogleAuthInfoException e) { if (isExportUri(uri)) throw e; return GoogleAuthInfo.parseUri(uri); }

Prevention

When it happens

Trigger: parseExportUri(Uri) called with a URI whose scheme is not the Aegis export scheme (e.g. an ordinary otpauth:// URI or an https link).

Common situations: Passing a normal otpauth URI to the export parser by mistake, handling a generic ACTION_VIEW intent that isn't an Aegis export, or a version mismatch where the scheme constant changed.

Understand the failure class

Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.

Related errors


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

Appendix: source

Thrown at app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java:182

     * Decodes the given base 32 secret, while being tolerant of whitespace and dashes.
     */
    public static byte[] parseSecret(String s) throws EncodingException {
        s = s.trim().replace("-", "").replace(" ", "");
        return Base32.decode(s);
    }

    public static Export parseExportUri(String s) throws GoogleAuthInfoException {
        Uri uri = Uri.parse(s);
        if (uri == null) {
            throw new GoogleAuthInfoException(uri, "Bad URI format");
        }
        return GoogleAuthInfo.parseExportUri(uri);
    }

    public static Export parseExportUri(Uri uri) throws GoogleAuthInfoException {
        String scheme = uri.getScheme();
        if (scheme == null || !scheme.equals(SCHEME_EXPORT)) {
            throw new GoogleAuthInfoException(uri, "Unsupported protocol");
        }

        String host = uri.getHost();
        if (host == null || !host.equals("offline")) {
            throw new GoogleAuthInfoException(uri, "Unsupported host");
        }

        String data = uri.getQueryParameter("data");
        if (data == null) {
            throw new GoogleAuthInfoException(uri, "Parameter 'data' is not set");
        }

        GoogleAuthProtos.MigrationPayload payload;
        try {
            byte[] bytes = Base64.decode(data);
            payload = GoogleAuthProtos.MigrationPayload.parseFrom(bytes);
        } catch (EncodingException | InvalidProtocolBufferException e) {
            throw new GoogleAuthInfoException(uri, e);

View on GitHub (pinned to d6f4e5925a)