apache/seatunnel · error · HttpConnectorException

FIELD_DATA_IS_INCONSISTENT

FIELD_DATA_IS_INCONSISTENT

Error message

[%s](%d) and [%s](%d) the number of parsing records is inconsistent.

What it means

JsonPathProcessorImpl.validateResultsConsistency requires every JsonPath to yield the same number of records so they can be zipped into rows. When path i's list size differs from the first path's size, FIELD_DATA_IS_INCONSISTENT is thrown naming both paths and their counts.

Solutions

  1. Make each path match exactly one value per array element (avoid nested [*] inside a field path)
  2. Provide default handling for optional/missing fields or adjust the path so it exists on every element
  3. Verify with a sample response that all paths return equal-length arrays

Example fix

// before
json_field = { path = ["$.rows[*].id", "$.rows[*].tags[*].name"] }  # variable tags count
// after
json_field = { path = ["$.rows[*].id"] }  # move tags to a separate transform/field
Defensive patterns

Strategy: validation

Validate before calling

for (JsonPath p : paths) assert List.of(JsonPath.read(sample, p.getPath())).stream().count() == expectedCount; // all equal before job run

Try / catch

try { rows = processor.processJsonData(ctx, jsonPaths); } catch (HttpConnectorException e) { if (e.getMessage().contains("number of parsing records is inconsistent")) { /* fix mismatched path cardinality */ } throw e; }

Prevention

When it happens

Trigger: processJsonData where JsonPaths evaluate to lists of differing lengths, e.g. $.a[*].x has 5 matches but $.b[*].y has 4 in the same response JSON.

Common situations: Optional fields that are missing on some array elements; nested arrays with different cardinalities; typos in one path matching more elements than intended.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/c1b4af096987c149. 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/JsonPathProcessorImpl.java:90

        return dataFlip(results);
    }

    /**
     * Helper method to validate that all results have the same size.
     *
     * @param results The list of results to validate
     * @param paths The JsonPath objects used to generate the results
     * @throws HttpConnectorException if results are inconsistent
     */
    protected void validateResultsConsistency(List<List<String>> results, JsonPath[] paths) {
        if (results.isEmpty()) {
            return;
        }

        int expectedSize = results.get(0).size();
        for (int i = 1; i < results.size(); i++) {
            if (results.get(i).size() != expectedSize) {
                throw new HttpConnectorException(
                        HttpConnectorErrorCode.FIELD_DATA_IS_INCONSISTENT,
                        String.format(
                                "[%s](%d) and [%s](%d) the number of parsing records is inconsistent.",
                                paths[0].getPath(),
                                expectedSize,
                                paths[i].getPath(),
                                results.get(i).size()));
            }
        }
    }

    /**
     * Flips a matrix of results so that rows become columns and vice versa.
     *
     * @param results The original data matrix
     * @return The flipped data matrix
     */
    protected List<List<String>> dataFlip(List<List<String>> results) {

View on GitHub (pinned to cf67b549a7)