apache/dolphinscheduler · error · IllegalArgumentException

Invalid child path

Error message

Invalid child path 

What it means

KeyUtils.isParent validates that both parentPath and childPath are non-empty strings starting with the registry path separator ('/') before comparing path segments. This specific throw fires when childPath is null or empty, refusing to compute a parent/child relationship against an invalid child path. The JDBC registry uses this helper for subscription and tree operations, so a malformed path would silently corrupt the segment comparison if not rejected.

Source

Thrown at dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-jdbc/src/main/java/org/apache/dolphinscheduler/plugin/registry/jdbc/KeyUtils.java:41

import org.apache.commons.lang3.StringUtils;

import lombok.experimental.UtilityClass;

@UtilityClass
public class KeyUtils {

    /**
     * Whether the path is the parent path of the child
     * <p> Only the parentPath is the parent path of the childPath, return true
     * <p> If the parentPath is equal to the childPath, return false
     */
    public static boolean isParent(final String parentPath, final String childPath) {
        if (StringUtils.isEmpty(parentPath)) {
            throw new IllegalArgumentException("Invalid parent path " + parentPath);
        }
        if (StringUtils.isEmpty(childPath)) {
            throw new IllegalArgumentException("Invalid child path " + childPath);
        }
        final String[] parentSplit = removeLastSlash(parentPath).split(RegistryConstants.PATH_SEPARATOR);
        final String[] childSplit = removeLastSlash(childPath).split(RegistryConstants.PATH_SEPARATOR);
        // If the parent path is longer than or equals the child path, it is impossible to be the parent path of the
        // child path
        if (parentSplit.length >= childSplit.length) {
            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) {

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Ensure the child path is a non-empty string starting with '/' before calling isParent
  2. Validate/trim the source of the path (config value, event payload) and fail early with a clear message
  3. Pass a normalized constant such as '/' when the caller genuinely means the root path

Example fix

// before
boolean parent = KeyUtils.isParent("/nodes", childPath); // childPath may be ""
// after
if (StringUtils.isNotEmpty(childPath) && childPath.startsWith("/")) {
    boolean parent = KeyUtils.isParent("/nodes", childPath);
}
Defensive patterns

Strategy: validation

Validate before calling

if (childPath == null || !childPath.startsWith("/")) { throw new IllegalArgumentException("childPath must be an absolute non-empty path"); }

Type guard

boolean isValidRegistryPath(String p) { return p != null && !p.isEmpty() && p.startsWith("/"); }

Try / catch

try { KeyUtils.isParent(parent, child); } catch (IllegalArgumentException e) { log.warn("Bad path: {}", e.getMessage()); }

Prevention

When it happens

Trigger: Calling KeyUtils.isParent(parentPath, "") or isParent(parentPath, null); passing a path variable that was never initialized or trimmed to empty from configuration or an event payload; calling higher-level JDBC registry APIs (e.g. subscribe/addListener paths) that delegate to isParent with a blank path.

Common situations: Registry paths read from misconfigured properties (empty registry path prefix), deserialized subscription records with missing path fields, or string manipulation that stripped the path down to empty before calling isParent.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/f1a9867ccbd0cbdd. Report an issue: GitHub.