{"record":{"id":"727f342cec9dfab8","repo":"beemdevelopment/Aegis","slug":"bad-uri-format","errorCode":null,"errorMessage":"Bad URI format","messagePattern":"Bad URI format","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java","lineNumber":174,"sourceCode":"        } catch (OtpInfoException | NumberFormatException e) {\n            throw new GoogleAuthInfoException(uri, e);\n        }\n\n        return new GoogleAuthInfo(info, accountName, issuer);\n    }\n\n    /**\n     * Decodes the given base 32 secret, while being tolerant of whitespace and dashes.\n     */\n    public static byte[] parseSecret(String s) throws EncodingException {\n        s = s.trim().replace(\"-\", \"\").replace(\" \", \"\");\n        return Base32.decode(s);\n    }\n\n    public static Export parseExportUri(String s) throws GoogleAuthInfoException {\n        Uri uri = Uri.parse(s);\n        if (uri == null) {\n            throw new GoogleAuthInfoException(uri, \"Bad URI format\");\n        }\n        return GoogleAuthInfo.parseExportUri(uri);\n    }\n\n    public static Export parseExportUri(Uri uri) throws GoogleAuthInfoException {\n        String scheme = uri.getScheme();\n        if (scheme == null || !scheme.equals(SCHEME_EXPORT)) {\n            throw new GoogleAuthInfoException(uri, \"Unsupported protocol\");\n        }\n\n        String host = uri.getHost();\n        if (host == null || !host.equals(\"offline\")) {\n            throw new GoogleAuthInfoException(uri, \"Unsupported host\");\n        }\n\n        String data = uri.getQueryParameter(\"data\");\n        if (data == null) {\n            throw new GoogleAuthInfoException(uri, \"Parameter 'data' is not set\");","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/beemdevelopment/Aegis/blob/d6f4e5925a97e4e91593f1542085eae03432a759/app/src/main/java/com/beemdevelopment/aegis/otp/GoogleAuthInfo.java#L156-L192","documentation":"Generic guard in parseExportUri(String): thrown when Uri.parse(s) returns null for the given export URI string, meaning the input could not be parsed as a URI at all. It fires on syntactically invalid or empty strings passed to vault export/import handling before any content is inspected.","triggerScenarios":"Calling parseExportUri(s) with a null or unparseable string s.","commonSituations":"Passing a raw JSON/text export instead of an aegis:// (otpauth-migration style) URI, or a truncated string from an intent/clipboard read.","solutions":["Verify the string is a complete export URI with the expected scheme before calling parseExportUri","Catch GoogleAuthInfoException and prompt the user to re-scan/re-share the export","Check the intent/clipboard source isn't returning empty or transformed text"],"exampleFix":"// before\nGoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(data);\n// after\nif (data != null && data.contains(\"://\")) {\n    GoogleAuthInfo.Export export = GoogleAuthInfo.parseExportUri(data);\n} else {\n    throw new GoogleAuthInfoException(null, \"Invalid export URI\");\n}","handlingStrategy":"try-catch","validationCode":"if (s == null || !s.contains(\"://\")) throw new IllegalArgumentException(\"not a URI\");","typeGuard":null,"tryCatchPattern":"try { GoogleAuthInfo.Export e = GoogleAuthInfo.parseExportUri(s); } catch (GoogleAuthInfoException ex) { showInvalidExportError(); }","preventionTips":["Confirm the shared payload is an export URI, not raw JSON/text","Validate intent extras before parsing","Catch GoogleAuthInfoException around all export import paths"],"tags":["android","otp","export","uri-parsing"],"backgroundTag":"invalid-url-format","analyzedSha":"d6f4e5925a97e4e91593f1542085eae03432a759","analyzedAt":"2026-09-08T00:46:31.111Z","contentChangedAt":"2026-09-08T00:46:31.111Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}