{"record":{"id":"a3ab0c4d95800244","repo":"apache/dolphinscheduler","slug":"invalid-path","errorCode":null,"errorMessage":"Invalid path ","messagePattern":"Invalid path ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java","lineNumber":66,"sourceCode":"            return false;\n        }\n        for (int i = 0; i < parentSplit.length; i++) {\n            if (!parentSplit[i].equals(childSplit[i])) {\n                return false;\n            }\n        }\n        return true;\n\n    }\n\n    public static boolean isSamePath(final String path1, final String path2) {\n        return removeLastSlash(path1).equals(path2);\n    }\n\n    private static String removeLastSlash(final String path) {\n        checkNotNull(path, \"path is null\");\n        if (!path.startsWith(RegistryConstants.PATH_SEPARATOR)) {\n            throw new IllegalArgumentException(\"Invalid path \" + path);\n        }\n        int length = path.length() - 1;\n        while (length >= 0 && path.charAt(length) == RegistryConstants.PATH_SEPARATOR_CHAR) {\n            length--;\n        }\n        if (length == -1) {\n            return RegistryConstants.PATH_SEPARATOR;\n        }\n        return path.substring(0, length + 1);\n    }\n\n}\n","sourceCodeStart":48,"sourceCodeEnd":79,"githubUrl":"https://github.com/apache/dolphinscheduler/blob/02eac45a1b6676e639fcbfb4be2243de5771b05d/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java#L48-L79","documentation":"KeyUtils.removeLastSlash normalizes a registry path by stripping trailing '/' characters, but first requires the path to be non-null and to start with the path separator '/'. This throw fires when a path does not begin with '/', meaning it is not an absolute registry path. All path splitting/normalization in KeyUtils depends on absolute paths, so relative paths would produce wrong segment arrays.","triggerScenarios":"Calling KeyUtils.removeLastSlash, isSamePath, or isParent with a relative path like \"nodes/master\" instead of \"/nodes/master\"; passing a path built by string concatenation that lost its leading slash; paths read from storage or events missing the leading separator.","commonSituations":"Developers building paths with StringUtils.join without prefixing '/', config values like registry.path=nodes (no leading slash), or paths stripped of their leading character by a buggy normalize function.","solutions":["Prefix the path with '/' if missing before passing it to KeyUtils","Use a central path-builder utility that always produces absolute paths","Check the configuration value for the registry path root and ensure it starts with '/'"],"exampleFix":"// before\nKeyUtils.isParent(parent, key.substring(1)); // lost leading slash\n// after\nString normalized = key.startsWith(\"/\") ? key : \"/\" + key;\nKeyUtils.isParent(parent, normalized);","handlingStrategy":"validation","validationCode":"if (path == null || !path.startsWith(\"/\")) { throw new IllegalArgumentException(\"path must start with '/'\"); }","typeGuard":"boolean isAbsolutePath(String p) { return p != null && p.startsWith(\"/\"); }","tryCatchPattern":"try { KeyUtils.isSamePath(a, b); } catch (IllegalArgumentException e) { log.warn(\"Non-absolute registry path rejected: {}\", a); }","preventionTips":["Concatenate paths as \"/\" + segment lists, never bare segment joins","Validate config registry paths at startup","Normalize incoming event paths before path utilities"],"tags":["registry","path","argument-validation"],"backgroundTag":"invalid-url-format","analyzedSha":"02eac45a1b6676e639fcbfb4be2243de5771b05d","analyzedAt":"2026-09-06T17:43:00.555Z","contentChangedAt":"2026-09-06T17:43:00.555Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}