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

GraphQLSinkWriter.write executes the configured HTTP request against the GraphQL endpoint after serializing the body. Any exception thrown during request execution/response handling inside the try block is logged and rethrown as CommonError.jsonOperationError('GraphQLSinkWriter', body, e) (COMMON-02), i.e. a generic JSON-operation failure carrying the request body.

Source

Thrown at seatunnel-connectors-v2/connector-graphql/src/main/java/org/apache/seatunnel/connectors/seatunnel/graphql/sink/GraphQLSinkWriter.java:95

        Map<String, Object> requestBody = new HashMap<>();
        requestBody.put("query", query);
        requestBody.put("variables", variablesTemplate);

        String body = gson.toJson(requestBody);

        try {
            HttpResponse response =
                    httpClient.doPost(httpParameter.getUrl(), httpParameter.getHeaders(), body);
            if (HttpResponse.STATUS_OK == response.getCode()) {
                return;
            }
            log.error(
                    "http client execute exception, http response status code:[{}], content:[{}]",
                    response.getCode(),
                    response.getContent());
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw CommonError.jsonOperationError("GraphQLSinkWriter", body, e);
        }
    }

    @Override
    public void close() throws IOException {
        if (Objects.nonNull(httpClient)) {
            httpClient.close();
        }
    }
}

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Read the underlying cause in the stack trace to distinguish connect vs JSON vs HTTP errors
  2. Verify the GraphQL endpoint URL and network reachability from the SeaTunnel worker
  3. Check authentication credentials/headers configured for the sink
  4. Validate that the row data matches the expected schema so the request body serializes correctly

Example fix

// before
url = "http://my-graphql/"
// after
url = "https://my-graphql-endpoint/graphql" (with correct auth headers)
Defensive patterns

Strategy: try-catch

Validate before calling

// Validate the GraphQL endpoint before running the sink
curl -s -o /dev/null -w "%{http_code}" -X POST \
  -H "Content-Type: application/json" \
  -d '{"query":"{__typename}"}' "$GRAPHQL_URL"

Try / catch

try {
    sinkWriter.write(row);
} catch (SeaTunnelCommonException e) {
    Throwable cause = e.getCause();
    log.error("GraphQL write failed for body; cause class: " + cause.getClass(), e);
    throw e;
}

Prevention

When it happens

Trigger: The HTTP call in GraphQLSinkWriter.write (httpclient execute, response read) or body construction throws any Exception — e.g. connection failure, invalid response, or serialization problem with the request body.

Common situations: Unreachable or misconfigured GraphQL endpoint URL; network/firewall blocking the sink; authentication rejected by the endpoint; malformed row data producing an invalid GraphQL request body.

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/2c506c4fc57b80a4. Report an issue: GitHub.