apache/seatunnel · error · EasysearchConnectorException

JSON_OPERATION_FAILED

JSON_OPERATION_FAILED

Error message

Object json deserialization exception.

What it means

serializeUpsert serializes the row key and document with Jackson; a JsonProcessingException (e.g. unserializable object, invalid date format, NaN) is wrapped as JSON_OPERATION_FAILED with the message 'Object json deserialization exception.' (misleadingly worded; it is a serialization failure).

Source

Thrown at seatunnel-connectors-v2/connector-easysearch/src/main/java/org/apache/seatunnel/connectors/seatunnel/easysearch/serialize/EasysearchRowSerializer.java:108

                        .append(objectMapper.writeValueAsString(document))
                        .append(", \"doc_as_upsert\" : true }")
                        .toString();
            } else {
                Map<String, String> indexMetadata = createMetadata(row);
                /**
                 * format example: { "index" : {"_index" : "${your_index}", "_id" :
                 * "${your_document_id}"} }\n ${your_document_json}
                 */
                return new StringBuilder()
                        .append("{ \"index\" :")
                        .append(objectMapper.writeValueAsString(indexMetadata))
                        .append("}")
                        .append("\n")
                        .append(objectMapper.writeValueAsString(document))
                        .toString();
            }
        } catch (JsonProcessingException e) {
            throw new EasysearchConnectorException(
                    JSON_OPERATION_FAILED, "Object json deserialization exception.", e);
        }
    }

    private String serializeDelete(SeaTunnelRow row) {
        String key = keyExtractor.apply(row);
        Map<String, String> deleteMetadata = createMetadata(row, key);
        try {
            /**
             * format example: { "delete" : {"_index" : "${your_index}", "_id" :
             * "${your_document_id}"} }
             */
            return new StringBuilder()
                    .append("{ \"delete\" :")
                    .append(objectMapper.writeValueAsString(deleteMetadata))
                    .append("}")
                    .toString();
        } catch (JsonProcessingException e) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the offending row's field types; convert unsupported types (e.g. Date/BigDecimal) to JSON-friendly values upstream.
  2. Ensure the sink's field-to-document conversion (toDocumentMap) only emits Jackson-serializable values.
  3. Configure the ObjectMapper (date format, FAIL_ON_EMPTY_BEANS) appropriately.
  4. Log the failing row to identify which field breaks serialization.

Example fix

// before
document.put("ts", java.sql.Timestamp value); // may fail
// after
document.put("ts", timestamp.toInstant().toString());
Defensive patterns

Strategy: try-catch

Validate before calling

objectMapper.writeValueAsString(document); // dry-run serialization before writing

Type guard

boolean jsonSafe(Object v) { try { objectMapper.writeValueAsString(v); return true; } catch (JsonProcessingException e) { return false; } }

Try / catch

try { serializer.serializeRow(row); } catch (EasysearchConnectorException e) { log row contents; dead-letter row; }

Prevention

When it happens

Trigger: A SeaTunnelRow field value that Jackson cannot serialize to JSON — custom objects, invalid temporal types, cyclic references — during upsert bulk action building.

Common situations: Complex/nested types from upstream sources not convertible by the configured ObjectMapper; date/time formats mismatched; MapData/ArrayData handled incorrectly by a custom serializer.

Understand the failure class

Background: json.Marshal / "failed to marshal" errors in Go: why "unsupported type" happens and how to fix it — this error's family across 22 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/71dcc8324fb85082. Report an issue: GitHub.