apache/dolphinscheduler · error · IllegalArgumentException
Invalid path
Error message
Invalid path
What it means
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.
Source
Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java:66
return false;
}
for (int i = 0; i < parentSplit.length; i++) {
if (!parentSplit[i].equals(childSplit[i])) {
return false;
}
}
return true;
}
public static boolean isSamePath(final String path1, final String path2) {
return removeLastSlash(path1).equals(path2);
}
private static String removeLastSlash(final String path) {
checkNotNull(path, "path is null");
if (!path.startsWith(RegistryConstants.PATH_SEPARATOR)) {
throw new IllegalArgumentException("Invalid path " + path);
}
int length = path.length() - 1;
while (length >= 0 && path.charAt(length) == RegistryConstants.PATH_SEPARATOR_CHAR) {
length--;
}
if (length == -1) {
return RegistryConstants.PATH_SEPARATOR;
}
return path.substring(0, length + 1);
}
}
View on GitHub (pinned to 02eac45a1b)
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 '/'
Example fix
// before
KeyUtils.isParent(parent, key.substring(1)); // lost leading slash
// after
String normalized = key.startsWith("/") ? key : "/" + key;
KeyUtils.isParent(parent, normalized); Defensive patterns
Strategy: validation
Validate before calling
if (path == null || !path.startsWith("/")) { throw new IllegalArgumentException("path must start with '/'"); } Type guard
boolean isAbsolutePath(String p) { return p != null && p.startsWith("/"); } Try / catch
try { KeyUtils.isSamePath(a, b); } catch (IllegalArgumentException e) { log.warn("Non-absolute registry path rejected: {}", a); } Prevention
- Concatenate paths as "/" + segment lists, never bare segment joins
- Validate config registry paths at startup
- Normalize incoming event paths before path utilities
When it happens
Trigger: 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.
Common situations: 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.
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
- Invalid parent path
- Invalid child path
- no master server available
- no master server available
- no master server available
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/a3ab0c4d95800244.
Report an issue: GitHub.