{"record":{"id":"bd8210423ba1923d","repo":"alibaba/ARouter","slug":"parameter-invalid","errorCode":null,"errorMessage":"Parameter invalid!","messagePattern":"Parameter invalid!","errorType":"exception","errorClass":"HandlerException","httpStatus":null,"severity":"error","filePath":"arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java","lineNumber":199,"sourceCode":"     */\n    protected Postcard build(String path) {\n        if (TextUtils.isEmpty(path)) {\n            throw new HandlerException(Consts.TAG + \"Parameter is invalid!\");\n        } else {\n            PathReplaceService pService = ARouter.getInstance().navigation(PathReplaceService.class);\n            if (null != pService) {\n                path = pService.forString(path);\n            }\n            return build(path, extractGroup(path), true);\n        }\n    }\n\n    /**\n     * Build postcard by uri\n     */\n    protected Postcard build(Uri uri) {\n        if (null == uri || TextUtils.isEmpty(uri.toString())) {\n            throw new HandlerException(Consts.TAG + \"Parameter invalid!\");\n        } else {\n            PathReplaceService pService = ARouter.getInstance().navigation(PathReplaceService.class);\n            if (null != pService) {\n                uri = pService.forUri(uri);\n            }\n            return new Postcard(uri.getPath(), extractGroup(uri.getPath()), uri, null);\n        }\n    }\n\n    /**\n     * Build postcard by path and group\n     */\n    protected Postcard build(String path, String group, Boolean afterReplace) {\n        if (TextUtils.isEmpty(path) || TextUtils.isEmpty(group)) {\n            throw new HandlerException(Consts.TAG + \"Parameter is invalid!\");\n        } else {\n            if (!afterReplace) {\n                PathReplaceService pService = ARouter.getInstance().navigation(PathReplaceService.class);","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/alibaba/ARouter/blob/84f451d244e3fb1d0e37801de1b9ee2af2f81d68/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java#L181-L217","documentation":"_ARouter.build(Uri uri) throws HandlerException when the Uri is null or its string form is empty. A Uri is required to derive path and group for the Postcard, so it is validated before PathReplaceService.forUri is consulted.","triggerScenarios":"Calling ARouter.build((Uri) null), or forwarding a Uri parsed from an empty/blank string; getIntent().getData() returning null on a deep-link entry point and passing it straight through.","commonSituations":"Deep-link handlers that don't check getData() for null; webview or push payload URLs that are empty after trimming; URIs built with Uri.parse(\"\").","solutions":["Null/empty-check the Uri before calling build","For activity deep links, check getIntent() != null && getIntent().getData() != null","Sanitize external URL payloads before converting to Uri"],"exampleFix":"// before\nUri uri = Uri.parse(pushPayload.getUrl());\nARouter.getInstance().build(uri).navigation(); // HandlerException if empty\n// after\nString url = pushPayload.getUrl();\nif (url != null && !url.trim().isEmpty()) {\n    ARouter.getInstance().build(Uri.parse(url)).navigation();\n}","handlingStrategy":"validation","validationCode":"if (uri == null || uri.toString().trim().isEmpty()) {\n    return; // cannot route\n}","typeGuard":"public static boolean isValidUri(Uri u) { return u != null && !u.toString().trim().isEmpty(); }","tryCatchPattern":"try {\n    ARouter.getInstance().build(uri).navigation();\n} catch (HandlerException e) {\n    Log.w(TAG, \"Invalid deep-link uri\", e);\n}","preventionTips":["Always null-check getIntent().getData() in deep-link activities","Sanitize external URLs before Uri.parse","Wrap deep-link handling in try-catch and fall back to home"],"tags":["android","arouter","uri","null","deep-link"],"backgroundTag":"null-argument","analyzedSha":"84f451d244e3fb1d0e37801de1b9ee2af2f81d68","analyzedAt":"2026-09-06T13:30:41.084Z","contentChangedAt":"2026-09-06T13:30:41.084Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}