{"record":{"id":"df47fdb75ecd1e77","repo":"alibaba/ARouter","slug":"parameter-is-invalid","errorCode":null,"errorMessage":"Parameter is invalid!","messagePattern":"Parameter is invalid!","errorType":"exception","errorClass":"HandlerException","httpStatus":null,"severity":"error","filePath":"arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java","lineNumber":184,"sourceCode":"    static void setLogger(ILogger userLogger) {\n        if (null != userLogger) {\n            logger = userLogger;\n        }\n    }\n\n    static void inject(Object thiz) {\n        AutowiredService autowiredService = ((AutowiredService) ARouter.getInstance().build(\"/arouter/service/autowired\").navigation());\n        if (null != autowiredService) {\n            autowiredService.autowire(thiz);\n        }\n    }\n\n    /**\n     * Build postcard by path and default group\n     */\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) {","sourceCodeStart":166,"sourceCodeEnd":202,"githubUrl":"https://github.com/alibaba/ARouter/blob/84f451d244e3fb1d0e37801de1b9ee2af2f81d68/arouter-api/src/main/java/com/alibaba/android/arouter/launcher/_ARouter.java#L166-L202","documentation":"_ARouter.build(String path) throws HandlerException when the path argument is null or empty. A route path is mandatory to construct a Postcard, so the library validates it immediately before consulting PathReplaceService.","triggerScenarios":"Calling ARouter.build(\"\") or build(null) directly, or a hasRoute/isRouteExist call that forwards an empty path string (e.g. a path variable that resolved to empty).","commonSituations":"Path loaded from remote config, intent extra, or database that came back empty; string concatenation producing \"\"; typo passing the group instead of the full path.","solutions":["Validate the path is non-empty before calling build/hasRoute","Log the source of the path (extra/config) to find why it is empty","Provide a fallback route or early return when the path is blank","If paths come through PathReplaceService, ensure the replacement doesn't return an empty string"],"exampleFix":"// before\nString path = getIntent().getStringExtra(\"target\");\nARouter.getInstance().build(path).navigation(); // HandlerException if empty\n// after\nString path = getIntent().getStringExtra(\"target\");\nif (!TextUtils.isEmpty(path)) {\n    ARouter.getInstance().build(path).navigation();\n} else {\n    finish();\n}","handlingStrategy":"validation","validationCode":"if (path == null || path.trim().isEmpty()) {\n    throw new IllegalArgumentException(\"route path must not be empty\");\n}","typeGuard":"public static boolean isValidPath(String p) { return p != null && !p.trim().isEmpty(); }","tryCatchPattern":"try {\n    ARouter.getInstance().build(path).navigation();\n} catch (HandlerException e) {\n    Log.w(TAG, \"Invalid route path\", e);\n}","preventionTips":["Validate paths sourced from configs/intents before building","Never pass unchecked intent extras directly to build()","Centralize navigation behind a wrapper that validates input"],"tags":["android","arouter","argument-validation","null"],"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"}