{"record":{"id":"5a7e77628a5f6e67","repo":"apache/seatunnel","slug":"common-02-5a7e77","errorCode":"COMMON-02","errorMessage":"<identifier> JSON convert/parse '<payload>' operation failed.","messagePattern":"<identifier> JSON convert/parse '<payload>' operation failed\\.","errorType":"error_code","errorClass":"SeaTunnelRuntimeException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/inject/StringInjectFunction.java","lineNumber":53,"sourceCode":"            throws SQLException {\n        try {\n            if (\"Point\".equals(fieldType)) {\n                statement.setObject(\n                        index, MAPPER.readValue(replace(value.toString()), double[].class));\n            } else if (\"Ring\".equals(fieldType)) {\n                statement.setObject(\n                        index, MAPPER.readValue(replace(value.toString()), double[][].class));\n            } else if (\"Polygon\".equals(fieldType)) {\n                statement.setObject(\n                        index, MAPPER.readValue(replace(value.toString()), double[][][].class));\n            } else if (\"MultiPolygon\".equals(fieldType)) {\n                statement.setObject(\n                        index, MAPPER.readValue(replace(value.toString()), double[][][][].class));\n            } else {\n                statement.setString(index, value.toString());\n            }\n        } catch (JsonProcessingException e) {\n            throw CommonError.jsonOperationError(\"Clickhouse\", value.toString(), e);\n        }\n    }\n\n    @Override\n    public boolean isCurrentFieldType(String fieldType) {\n        if (\"String\".equals(fieldType)\n                || \"Int128\".equals(fieldType)\n                || \"UInt128\".equals(fieldType)\n                || \"Int256\".equals(fieldType)\n                || \"UInt256\".equals(fieldType)\n                || \"Point\".equals(fieldType)\n                || \"Ring\".equals(fieldType)\n                || \"Polygon\".equals(fieldType)\n                || \"MultiPolygon\".equals(fieldType)) {\n            this.fieldType = fieldType;\n            return true;\n        }\n        return false;","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/inject/StringInjectFunction.java#L35-L71","documentation":"ClickHouse sink's StringInjectFunction.injectFields() writes a Java field value into a JDBC PreparedStatement. For nested ClickHouse types (e.g. multidimensional arrays of Doubles) it parses the value's string form with Jackson (MAPPER.readValue). If the string is not valid/expected JSON, JsonProcessingException is caught and rethrown as CommonError.jsonOperationError(\"Clickhouse\", value, e) (COMMON-02).","triggerScenarios":"Injecting a String field into a ClickHouse column backed by StringInjectFunction where the value must be parsed as JSON (e.g. double[][][][]) but the value's toString() is not parseable JSON — malformed arrays, single quotes, unquoted strings, or non-array scalars.","commonSituations":"Upstream data contains non-JSON strings (e.g. '[1,2,' truncated, or \"1.0\" where a nested array is expected); values serialized with single quotes or Python-style repr; encoding/escaping issues from a source connector.","solutions":["Inspect the '<payload>' in the error message and fix the upstream data to be valid JSON matching the target ClickHouse type (e.g. [[1.0,2.0]] for double[][]).","Add a transform upstream to sanitize/normalize nested array values into strict JSON before the sink.","Change the ClickHouse column type (or schema mapping) so the value uses setString instead of JSON parsing if it's plain text.","Check the wrapped JsonProcessingException cause to identify the exact malformed position."],"exampleFix":"// before (value)\n\"[[1.0, 2.0], [3.0]]'  // trailing quote, invalid JSON\n// after\n\"[[1.0,2.0],[3.0]]\"","handlingStrategy":"validation","validationCode":"java\n// Pre-validate nested array values are strict JSON before the ClickHouse sink\nString s = value.toString();\nnew ObjectMapper().readTree(s); // throws if not valid JSON — validate upstream","typeGuard":null,"tryCatchPattern":"java\ntry {\n    injectFunction.injectFields(statement, index, value, fieldType);\n} catch (SeaTunnelException e) {\n    if (e.getMessage().contains(\"JSON convert/parse\")) {\n        // log payload; sanitize or dead-letter the record\n    } else { throw e; }\n}","preventionTips":["Emit nested arrays as strict JSON (double quotes, no trailing commas) from upstream.","Sanitize values with a transform before the ClickHouse sink.","Match ClickHouse column types to actual payload shapes so setString is used for plain text.","Spot-check source connector output for JSON validity in staging."],"tags":["clickhouse","json","jdbc","serialization"],"backgroundTag":"json-parse-error","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}