apache/seatunnel · error · AmazonSqsConnectorException

DESERIALIZE_FAILED

DESERIALIZE_FAILED

Error message

Failed to deserialize Amazon SQS message

What it means

AmazonSqsDeserializer.deserializeRow parses an SQS message body into a SeaTunnelRow. If parsing produced a null row (and the failure path returned null because ignoreParseErrors semantics allow it) and ignoreParseErrors is false, it throws AmazonSqsConnectorException with code DESERIALIZE_FAILED, failing the read of that message.

Source

Thrown at seatunnel-connectors-v2/connector-amazonsqs/src/main/java/org/apache/seatunnel/connectors/seatunnel/amazonsqs/deserialize/AmazonSqsDeserializer.java:71

        this.format = format;
    }

    @Override
    public SeaTunnelRow deserializeRow(String row) {
        SeaTunnelRow seaTunnelRow;
        try {
            seaTunnelRow = deserializationSchema.deserialize(row.getBytes(StandardCharsets.UTF_8));
        } catch (SeaTunnelRuntimeException e) {
            // JSON parsing wraps failures in COMMON-02; unrelated runtime errors must propagate.
            if (!CommonErrorCode.JSON_OPERATION_FAILED.equals(e.getSeaTunnelErrorCode())) {
                throw e;
            }
            return handleDeserializationFailure(e);
        } catch (IOException e) {
            return handleDeserializationFailure(e);
        }
        if (seaTunnelRow == null && !ignoreParseErrors) {
            throw new AmazonSqsConnectorException(
                    AmazonSqsConnectorErrorCode.DESERIALIZE_FAILED,
                    "Failed to deserialize Amazon SQS message");
        }
        return seaTunnelRow;
    }

    private SeaTunnelRow handleDeserializationFailure(Throwable cause) {
        if (ignoreParseErrors) {
            return null;
        }
        throw new AmazonSqsConnectorException(
                AmazonSqsConnectorErrorCode.DESERIALIZE_FAILED,
                "Failed to deserialize Amazon SQS message",
                cause);
    }

    @Override
    public List<SeaTunnelRow> deserializeRows(String row) {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Inspect the offending SQS message body and align the producer with the configured format and schema.
  2. Set the sink/source format config correctly (e.g. format=json) to match message content.
  3. Set ignore-parse-errors=true if bad messages should be skipped instead of failing the job.
  4. Add a DLQ on the SQS queue to isolate malformed messages.

Example fix

// before
format = json   // but queue contains CSV
// after
format = csv
Defensive patterns

Strategy: validation

Validate before calling

String body = message.body();
if (body == null || body.trim().isEmpty() || !body.trim().startsWith("{")) {
    log.warn("Skipping non-JSON SQS message"); return null;
}

Type guard

null

Try / catch

try { row = deserializer.deserializeRow(message); } catch (AmazonSqsConnectorException e) { if (DESERIALIZE_FAILED.equals(e.getSeaTunnelErrorCode())) { deadLetter(message); } else { throw e; } }

Prevention

When it happens

Trigger: The message body cannot be parsed into a valid row (empty body, body not matching the configured format, all fields filtered out) and ignoreParseErrors=false; the deserialization schema returned null without an exception being routed through the cause-wrapping path.

Common situations: Queue receives non-JSON/non-format-conforming messages (control messages, plaintext, base64 payloads); format configured as json but producers send CSV; fields missing that the schema requires causing the schema to yield a null row.

Understand the failure class

Background: "failed to unmarshal" / json.Unmarshal errors: why parsing a response into a Go struct fails and how to fix it — this error's family across 23 libraries.

Related errors


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