apache/seatunnel · error · SeaTunnelRuntimeException
COMMON-02
COMMON-02
Error message
<identifier> JSON convert/parse '<payload>' operation failed.
What it means
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.
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
Example fix
// before: raw double may be NaN row.setField(i, Double.NaN); // after: guard before write row.setField(i, Double.isNaN(v) ? null : v);
Defensive patterns
Strategy: try-catch
Try / catch
try { documentStr = objectMapper.writeValueAsString(document); } catch (JsonProcessingException e) { LOG.error("Unserializable document: {}", document, e); throw e; } Prevention
- 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
When it happens
Trigger: serializeUpsert calls objectMapper.writeValueAsString(document) and Jackson throws JsonProcessingException (e.g. unserializable value, circular reference, invalid type in the document map).
Common situations: 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.
Understand the failure class
Background: "JSON serialization failed", "not JSON serializable", "Failed to serialize": why JSON marshaling errors happen and how to fix them — this error's family across 46 libraries.
Related errors
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/40007d48e8c1c100.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-elasticsearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/elasticsearch/serialize/ElasticsearchRowSerializer.java:111
case UPDATE_BEFORE:
case DELETE:
return serializeDelete(row);
default:
throw new ElasticsearchConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
"Unsupported write row kind: " + row.getRowKind());
}
}
private String serializeUpsert(SeaTunnelRow row) {
String key = keyExtractor.apply(row);
Map<String, Object> document = toDocumentMap(row, seaTunnelRowType);
String documentStr;
try {
documentStr = objectMapper.writeValueAsString(document);
} catch (JsonProcessingException e) {
throw CommonError.jsonOperationError(
"Elasticsearch", "document:" + document.toString(), e);
}
if (key != null) {
Map<String, String> upsertMetadata = createMetadata(row, key);
String upsertMetadataStr;
try {
upsertMetadataStr = objectMapper.writeValueAsString(upsertMetadata);
} catch (JsonProcessingException e) {
throw CommonError.jsonOperationError(
"Elasticsearch", "upsertMetadata:" + upsertMetadata.toString(), e);
}
/**
* format example: { "update" : {"_index" : "${your_index}", "_id" :
* "${your_document_id}"} }\n { "doc" : ${your_document_json}, "doc_as_upsert" : true }
*/
return new StringBuilder()View on GitHub (pinned to cf67b549a7)