{"record":{"id":"c1b4af096987c149","repo":"apache/seatunnel","slug":"field-data-is-inconsistent-c1b4af","errorCode":"FIELD_DATA_IS_INCONSISTENT","errorMessage":"[%s](%d) and [%s](%d) the number of parsing records is inconsistent.","messagePattern":"\\[(.+?)\\]\\((.+?)\\) and \\[(.+?)\\]\\((.+?)\\) the number of parsing records is inconsistent\\.","errorType":"error_code","errorClass":"HttpConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/JsonPathProcessorImpl.java","lineNumber":90,"sourceCode":"        return dataFlip(results);\n    }\n\n    /**\n     * Helper method to validate that all results have the same size.\n     *\n     * @param results The list of results to validate\n     * @param paths The JsonPath objects used to generate the results\n     * @throws HttpConnectorException if results are inconsistent\n     */\n    protected void validateResultsConsistency(List<List<String>> results, JsonPath[] paths) {\n        if (results.isEmpty()) {\n            return;\n        }\n\n        int expectedSize = results.get(0).size();\n        for (int i = 1; i < results.size(); i++) {\n            if (results.get(i).size() != expectedSize) {\n                throw new HttpConnectorException(\n                        HttpConnectorErrorCode.FIELD_DATA_IS_INCONSISTENT,\n                        String.format(\n                                \"[%s](%d) and [%s](%d) the number of parsing records is inconsistent.\",\n                                paths[0].getPath(),\n                                expectedSize,\n                                paths[i].getPath(),\n                                results.get(i).size()));\n            }\n        }\n    }\n\n    /**\n     * Flips a matrix of results so that rows become columns and vice versa.\n     *\n     * @param results The original data matrix\n     * @return The flipped data matrix\n     */\n    protected List<List<String>> dataFlip(List<List<String>> results) {","sourceCodeStart":72,"sourceCodeEnd":108,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-http/connector-http-base/src/main/java/org/apache/seatunnel/connectors/seatunnel/http/util/JsonPathProcessorImpl.java#L72-L108","documentation":"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.","triggerScenarios":"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.","commonSituations":"Optional fields that are missing on some array elements; nested arrays with different cardinalities; typos in one path matching more elements than intended.","solutions":["Make each path match exactly one value per array element (avoid nested [*] inside a field path)","Provide default handling for optional/missing fields or adjust the path so it exists on every element","Verify with a sample response that all paths return equal-length arrays"],"exampleFix":"// before\njson_field = { path = [\"$.rows[*].id\", \"$.rows[*].tags[*].name\"] }  # variable tags count\n// after\njson_field = { path = [\"$.rows[*].id\"] }  # move tags to a separate transform/field","handlingStrategy":"validation","validationCode":"for (JsonPath p : paths) assert List.of(JsonPath.read(sample, p.getPath())).stream().count() == expectedCount; // all equal before job run","typeGuard":null,"tryCatchPattern":"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; }","preventionTips":["Ensure each field path matches exactly one value per array element","Avoid nested [*] within per-element field paths","Test against representative responses with optional fields present and absent"],"tags":["jsonpath","data-consistency","array"],"backgroundTag":"unexpected-response-shape","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}