{"record":{"id":"a5a6a3ba99a97b03","repo":"apache/seatunnel","slug":"deserialize-failed","errorCode":"DESERIALIZE_FAILED","errorMessage":"Failed to deserialize Amazon SQS message","messagePattern":"Failed to deserialize Amazon SQS message","errorType":"error_code","errorClass":"AmazonSqsConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-amazonsqs/src/main/java/org/apache/seatunnel/connectors/seatunnel/amazonsqs/deserialize/AmazonSqsDeserializer.java","lineNumber":71,"sourceCode":"        this.format = format;\n    }\n\n    @Override\n    public SeaTunnelRow deserializeRow(String row) {\n        SeaTunnelRow seaTunnelRow;\n        try {\n            seaTunnelRow = deserializationSchema.deserialize(row.getBytes(StandardCharsets.UTF_8));\n        } catch (SeaTunnelRuntimeException e) {\n            // JSON parsing wraps failures in COMMON-02; unrelated runtime errors must propagate.\n            if (!CommonErrorCode.JSON_OPERATION_FAILED.equals(e.getSeaTunnelErrorCode())) {\n                throw e;\n            }\n            return handleDeserializationFailure(e);\n        } catch (IOException e) {\n            return handleDeserializationFailure(e);\n        }\n        if (seaTunnelRow == null && !ignoreParseErrors) {\n            throw new AmazonSqsConnectorException(\n                    AmazonSqsConnectorErrorCode.DESERIALIZE_FAILED,\n                    \"Failed to deserialize Amazon SQS message\");\n        }\n        return seaTunnelRow;\n    }\n\n    private SeaTunnelRow handleDeserializationFailure(Throwable cause) {\n        if (ignoreParseErrors) {\n            return null;\n        }\n        throw new AmazonSqsConnectorException(\n                AmazonSqsConnectorErrorCode.DESERIALIZE_FAILED,\n                \"Failed to deserialize Amazon SQS message\",\n                cause);\n    }\n\n    @Override\n    public List<SeaTunnelRow> deserializeRows(String row) {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-amazonsqs/src/main/java/org/apache/seatunnel/connectors/seatunnel/amazonsqs/deserialize/AmazonSqsDeserializer.java#L53-L89","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Inspect the offending SQS message body and align the producer with the configured format and schema.","Set the sink/source format config correctly (e.g. format=json) to match message content.","Set ignore-parse-errors=true if bad messages should be skipped instead of failing the job.","Add a DLQ on the SQS queue to isolate malformed messages."],"exampleFix":"// before\nformat = json   // but queue contains CSV\n// after\nformat = csv","handlingStrategy":"validation","validationCode":"String body = message.body();\nif (body == null || body.trim().isEmpty() || !body.trim().startsWith(\"{\")) {\n    log.warn(\"Skipping non-JSON SQS message\"); return null;\n}","typeGuard":"null","tryCatchPattern":"try { row = deserializer.deserializeRow(message); } catch (AmazonSqsConnectorException e) { if (DESERIALIZE_FAILED.equals(e.getSeaTunnelErrorCode())) { deadLetter(message); } else { throw e; } }","preventionTips":["Match the connector's format config to the producer's actual payload format.","Validate message bodies in the producer before enqueueing.","Set ignore-parse-errors=true with a DLQ for poisoned messages."],"tags":["java","sqs","deserialization"],"backgroundTag":"json-unmarshal-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}