{"record":{"id":"40007d48e8c1c100","repo":"apache/seatunnel","slug":"common-02-40007d","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-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/ElasticsearchRowSerializer.java","lineNumber":111,"sourceCode":"            case UPDATE_BEFORE:\n            case DELETE:\n                return serializeDelete(row);\n            default:\n                throw new ElasticsearchConnectorException(\n                        CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,\n                        \"Unsupported write row kind: \" + row.getRowKind());\n        }\n    }\n\n    private String serializeUpsert(SeaTunnelRow row) {\n        String key = keyExtractor.apply(row);\n        Map<String, Object> document = toDocumentMap(row, seaTunnelRowType);\n        String documentStr;\n\n        try {\n            documentStr = objectMapper.writeValueAsString(document);\n        } catch (JsonProcessingException e) {\n            throw CommonError.jsonOperationError(\n                    \"Elasticsearch\", \"document:\" + document.toString(), e);\n        }\n\n        if (key != null) {\n            Map<String, String> upsertMetadata = createMetadata(row, key);\n            String upsertMetadataStr;\n            try {\n                upsertMetadataStr = objectMapper.writeValueAsString(upsertMetadata);\n            } catch (JsonProcessingException e) {\n                throw CommonError.jsonOperationError(\n                        \"Elasticsearch\", \"upsertMetadata:\" + upsertMetadata.toString(), e);\n            }\n\n            /**\n             * format example: { \"update\" : {\"_index\" : \"${your_index}\", \"_id\" :\n             * \"${your_document_id}\"} }\\n { \"doc\" : ${your_document_json}, \"doc_as_upsert\" : true }\n             */\n            return new StringBuilder()","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/ElasticsearchRowSerializer.java#L93-L129","documentation":"Elasticsearch serialization failed while converting the row document map to JSON with Jackson. CommonError.jsonOperationError wraps the JsonProcessingException, identifying the connector and the payload (the document map) that could not be serialized.","triggerScenarios":"serializeUpsert calls objectMapper.writeValueAsString(document) and Jackson throws JsonProcessingException (e.g. unserializable value, circular reference, invalid type in the document map).","commonSituations":"Row fields contain objects Jackson cannot serialize (e.g. byte[] with odd config, custom objects); NaN/Infinity doubles with strict mapper settings; very deep nesting exceeding StreamWriteConstraints in newer Jackson.","solutions":["Inspect row field values for unserializable content (NaN, exotic objects) and normalize in a transform","Increase Jackson StreamRead/WriteConstraints if nesting is deep (newer Jackson versions enforce nesting limits)","Upgrade/align the Jackson version to avoid serialization edge cases"],"exampleFix":"// before: raw double may be NaN\nrow.setField(i, Double.NaN);\n// after: guard before write\nrow.setField(i, Double.isNaN(v) ? null : v);","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { documentStr = objectMapper.writeValueAsString(document); } catch (JsonProcessingException e) { LOG.error(\"Unserializable document: {}\", document, e); throw e; }","preventionTips":["Guard against NaN/Infinity in numeric fields before writing","Keep document values as simple JSON-compatible types (String, Number, Boolean, List, Map)","Check Jackson stream constraints when nesting deeply"],"tags":["elasticsearch","json","serialization"],"backgroundTag":"json-serialization-failed","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"}