apache/seatunnel · error · org.apache.seatunnel.common.exception.SeaTunnelRuntimeException

COMMON-02

COMMON-02

Error message

<identifier> JSON convert/parse '<payload>' operation failed.

What it means

GoogleSheetsDeserializer.deserializeRow converts each row map to a JSON string with Jackson's ObjectMapper and hands it to the configured SeaTunnelDeserializationSchema. If Jackson cannot serialize the row map (JsonProcessingException), the connector wraps it in a CommonError JSON-operation error (COMMON-02) naming the connector and payload. This indicates the row data could not be converted to the JSON representation the deserialization schema expects.

Source

Thrown at seatunnel-connectors-v2/connector-google-sheets/src/main/java/org/apache/seatunnel/connectors/seatunnel/google/sheets/deserialize/GoogleSheetsDeserializer.java:58

            String[] fields, DeserializationSchema<SeaTunnelRow> deserializationSchema) {
        this.fields = fields;
        this.deserializationSchema = deserializationSchema;
    }

    @Override
    public SeaTunnelRow deserializeRow(List<Object> row) {
        Map<String, Object> map = new HashMap<>();
        for (int i = 0; i < row.size(); i++) {
            if (i < fields.length) {
                map.put(fields[i], row.get(i));
            }
        }

        try {
            String rowStr = objectMapper.writeValueAsString(map);
            return deserializationSchema.deserialize(rowStr.getBytes());
        } catch (JsonProcessingException e) {
            throw CommonError.jsonOperationError("GoogleSheets", map.toString(), e);
        } catch (IOException e) {
            throw GoogleSheetsError.deserializeError(map.toString(), e);
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the payload printed in the error message for values that cannot be serialized to JSON
  2. Upgrade/align the Jackson (jackson-databind) version used by the connector
  3. Check any custom deserializationSchema implementation for content that breaks serialization
  4. Enable JsonUtils/ObjectMapper forgiving features (e.g. FAIL_ON_EMPTY_BEANS=false) if bean serialization is the issue

Example fix

// before
return deserializationSchema.deserialize(rowStr.getBytes());
// after
String rowStr = JsonUtils.toJsonString(map);
return deserializationSchema.deserialize(rowStr.getBytes(StandardCharsets.UTF_8));
Defensive patterns

Strategy: try-catch

Validate before calling

// Java: verify the map is JSON-serializable before calling deserializeRow
try {
    new ObjectMapper().writeValueAsString(rowMap);
} catch (JsonProcessingException e) {
    throw new IllegalStateException("Row not serializable: " + e.getMessage(), e);
}

Type guard

boolean isJsonSerializable(Object o) {
    try { new ObjectMapper().writeValueAsString(o); return true; }
    catch (JsonProcessingException e) { return false; }
}

Try / catch

try {
    deserializer.deserializeRow(rowMap);
} catch (SeaTunnelCommonException e) {
    if (e.getCommonCode() == CommonErrorCode.JSON_OPERATION_FAILED) {
        log.error("Unserializable Google Sheets row payload", e);
        // skip or dead-letter the row
    } else { throw e; }
}

Prevention

When it happens

Trigger: objectMapper.writeValueAsString(map) throws JsonProcessingException while serializing a Google Sheets row map, e.g. the map contains a value Jackson cannot serialize (unwritable/self-referencing object) or a serialization feature blocks the write.

Common situations: Custom/corrupted cell values producing non-serializable objects; running with a Jackson version or configuration that fails on certain map values; debugging with modified deserialization code that injects unusual payloads.

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/758b16eb46624aaa. Report an issue: GitHub.