{"record":{"id":"c6110fc90461fb4b","repo":"apache/flink","slug":"illegal-json-data","errorCode":null,"errorMessage":"Illegal Json Data...","messagePattern":"Illegal Json Data\\.\\.\\.","errorType":"exception","errorClass":"java.lang.IllegalStateException","httpStatus":null,"severity":"error","filePath":"flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonParserToRowDataConverters.java","lineNumber":608,"sourceCode":"                path[i] = fieldIndex;\n            }\n            outputPosToPath.put(pos, path);\n        }\n    }\n\n    private class RowNestedConverter extends ProjectedConverter {\n\n        private static final long serialVersionUID = 1L;\n\n        private final Map<String, ProjectedConverter> fieldConverters = new HashMap<>();\n\n        // Keep path here for fallback to get nested field from a converted row field.\n        private final Map<Integer, String[]> outputPosToPath = new HashMap<>();\n\n        @Override\n        public void convertNotNull(JsonParser jp, GenericRowData outputRow) throws IOException {\n            if (jp.currentToken() != JsonToken.START_OBJECT) {\n                throw new IllegalStateException(\"Illegal Json Data...\");\n            }\n            int arity = fieldConverters.size();\n            int cnt = 0;\n            jp.nextToken();\n            while (jp.currentToken() != JsonToken.END_OBJECT) {\n                if (cnt >= arity) {\n                    skipToNextField(jp);\n                    continue;\n                }\n                String fieldName = jp.getText();\n                jp.nextToken();\n                ProjectedConverter converter = fieldConverters.get(fieldName);\n                if (converter != null) {\n                    converter.convert(jp, outputRow);\n                    jp.nextToken();\n                    cnt++;\n                } else {\n                    skipToNextField(jp);","sourceCodeStart":590,"sourceCodeEnd":626,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-formats/flink-json/src/main/java/org/apache/flink/formats/json/JsonParserToRowDataConverters.java#L590-L626","documentation":"IllegalStateException from RowNestedConverter.convertNotNull (the projected/nested-row path used when only selected nested fields are extracted) when the token is not START_OBJECT. It is the nested-projection counterpart of error 1375: the JSON fragment being projected must be an object, but a scalar/array was found.","triggerScenarios":"Using nested-field projection (e.g., SELECT info.name from a ROW-typed or json_derived column) where the projected source in the payload is not a JSON object — e.g., \"info\": \"N/A\" or \"info\": [..].","commonSituations":"Same shape-mismatch family as 1372/1374/1375, hit specifically when the optimizer prunes to nested fields and the nested converter runs instead of the full row converter.","solutions":["Align DDL nested types with the real payload shape (nested ROW fields must be JSON objects)","Fix producer output for that nested field","With ignore-parse-errors=true the record is skipped rather than failing (verify policy fit first)"],"exampleFix":"-- before: info ROW<name STRING> but data is \"info\": \"n/a\"\nSELECT info.name FROM t\n\n-- after: model it as what it is\ninfo STRING","handlingStrategy":"try-catch","validationCode":"JsonNode n = mapper.readTree(sample).get(\"info\");\nif (n != null && !n.isObject()) throw new IllegalStateException(\"projected nested field source must be an object\");","typeGuard":null,"tryCatchPattern":"catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Illegal Json Data\")) {\n        // nested projection hit a non-object; align nested schema or skip row\n    }\n}","preventionTips":["Validate nested-field shapes on samples when using nested projections","Keep nested ROW columns mapped to real JSON objects in producer code"],"tags":["flink","json","nested-projection","row","data-quality"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}