apache/seatunnel · error · SeaTunnelRuntimeException

COMMON-02

COMMON-02

Error message

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

What it means

The Assert sink's AssertExecutor.compareValue() wraps assertion config parsing: it converts the assertion config JSON into the expected value via a type converter. If any IOException occurs during that JSON conversion/parse, CommonError.jsonOperationError("Assert", confJsonStr, e) (COMMON-02) is thrown, reporting that the Assert connector failed a JSON convert/parse operation on the given payload.

Solutions

  1. Validate the assertion rule JSON in your config file — ensure each rule is well-formed and matches the expected schema for the field type.
  2. Check the wrapped IOException (cause) in the stack trace to find the exact JSON parse failure point.
  3. Ensure rule value types in config match the column types being asserted (e.g. numeric rules for numeric columns).
  4. Escape special characters in configured string values and re-run the job.

Example fix

// before (config)
AssertSink {
  rules = { field_name = id, rules = [{ field_type = int, field_value = "not-a-number" }] }
}

// after
AssertSink {
  rules = { field_name = id, rules = [{ field_type = int, field_value = 42 }] }
}
Defensive patterns

Strategy: validation

Validate before calling

java
// Validate assertion rule JSON before running the job
JsonNode rules = JsonUtils.stringToJsonNode(ruleConfigJson);
if (rules == null || !rules.isObject()) {
    throw new IllegalArgumentException("Invalid Assert rule JSON: " + ruleConfigJson);
}

Try / catch

java
try {
    boolean ok = assertExecutor.pass(value, type, config);
} catch (SeaTunnelException e) {
    if (e.getMessage().contains("JSON convert/parse")) {
        // log payload and fix assertion rule config
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling AssertExecutor.pass() with a rule config whose JSON cannot be converted for the given field name — e.g. JsonUtils.stringToJsonNode(JsonUtils.toJsonString(config)) or converter.convert() raising IOException for malformed or incompatible JSON content.

Common situations: Malformed assertion rules in the seatunnel config file (bad JSON structure for field rules); rule type mismatched with the field's declared type so the converter fails; special characters or encoding issues in configured rule values.

Understand the failure class

Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.

Related errors


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

Appendix: source

Thrown at seatunnel-connectors-v2/connector-assert/src/main/java/org/apache/seatunnel/connectors/seatunnel/assertion/excecutor/AssertExecutor.java:186

    private boolean compareValue(
            Object value,
            SeaTunnelDataType<?> type,
            AssertFieldRule.AssertRule valueRule,
            String fieldName) {
        Object config = valueRule.getEqualTo();
        String confJsonStr = JsonUtils.toJsonString(config);

        JsonToRowConverters converters = new JsonToRowConverters(true, false);
        JsonToRowConverters.JsonToObjectConverter converter = converters.createConverter(type);

        Object confValue;
        try {
            confValue =
                    converter.convert(
                            JsonUtils.stringToJsonNode(JsonUtils.toJsonString(config)), fieldName);
        } catch (IOException e) {
            throw CommonError.jsonOperationError("Assert", confJsonStr, e);
        }
        return compareValue(value, type, confValue);
    }

    private boolean compareValue(Object value, SeaTunnelDataType<?> type, Object confValue) {
        switch (type.getSqlType()) {
            case ROW:
                {
                    return compareRowValue(
                            (SeaTunnelRow) value,
                            (SeaTunnelRowType) type,
                            (SeaTunnelRow) confValue);
                }
            case ARRAY:
                {
                    return compareArrayValue(
                            (Object[]) value, (ArrayType<?, ?>) type, (Object[]) confValue);
                }

View on GitHub (pinned to cf67b549a7)