apache/seatunnel · error · IllegalArgumentException

Parent path must contain [*] for ArrayJsonPathProcessor

Error message

Parent path must contain [*] for ArrayJsonPathProcessor

What it means

ArrayJsonPathProcessor.getRelativePath requires the computed parent path to contain the [*] wildcard; otherwise the relative-path logic is meaningless and an IllegalArgumentException is thrown. This indicates the common parent extraction produced a non-array path.

Solutions

  1. Add [*] to the array segment of your json_field paths (e.g. $.data.items[*].id)
  2. Use the default (non-array) JsonPathProcessor for flat paths without arrays
  3. Report/inspect extractCommonParentPath if the input clearly contains [*] but the error still fires

Example fix

// before
json_field = { path = ["$.data.id", "$.data.name"] }
// after
json_field = { path = ["$.data.items[*].id", "$.data.items[*].name"] }
Defensive patterns

Strategy: validation

Validate before calling

if (!parentPath.contains("[*]")) { throw new IllegalArgumentException("Array processor requires paths with [*]"); }

Prevention

When it happens

Trigger: Calling ArrayJsonPathProcessor with paths whose extracted common parent lacks [*] — i.e. the JsonPaths do not point into arrays (e.g. $.data.field instead of $.data.items[*].field).

Common situations: Misconfigured json_field paths without array wildcards routed into the array processor; a regression in extractCommonParentPath returning a plain prefix.

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/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/66bb74bf003d4c94. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/ArrayJsonPathProcessor.java:81

                        String.format(
                                "Paths have different array parents. Expected '%s' but found path starting with '%s'",
                                parentPath, pathStrings[i]));
            }
        }

        return parentPath;
    }

    /**
     * Get a relative path based on a parent path and a full path.
     *
     * @param parentPath The parent path
     * @param fullPath The complete path
     * @return The relative path from parent to full path
     */
    private String getRelativePath(String parentPath, String fullPath) {
        if (!parentPath.contains("[*]")) {
            throw new IllegalArgumentException(
                    "Parent path must contain [*] for ArrayJsonPathProcessor");
        }

        if (!fullPath.contains("[*]")) {
            // For non-array paths when parent has [*], extract the correct relative part
            String commonPart = parentPath.substring(0, parentPath.indexOf("[*]"));
            String relativePart = fullPath.substring(commonPart.length());

            // If the relative part starts with a dot, remove it
            if (relativePart.startsWith(".")) {
                relativePart = relativePart.substring(1);
            }

            return "$." + relativePart;
        } else {
            // Original implementation for array paths
            String relativePart = fullPath.substring(parentPath.length());

View on GitHub (pinned to cf67b549a7)