{"record":{"id":"477d7390e6cc6a55","repo":"apache/seatunnel","slug":"decode-failed","errorCode":"DECODE_FAILED","errorMessage":"Decode ingress packet failed for batchId={}","messagePattern":"Decode ingress packet failed for batchId=(.+?)","errorType":"console","errorClass":"EdgeSocketConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketSourceReader.java","lineNumber":208,"sourceCode":"            queueFullCount++;\n            if (queueFullCount == 1 || queueFullCount % 100 == 0) {\n                log.warn(\n                        \"Ingress queue physically full, returning RETRY \"\n                                + \"(capacity={}, rejectCount={}, batchId={})\",\n                        config.getLocalQueueCapacity(),\n                        queueFullCount,\n                        batchId);\n            }\n            return EdgeSocketResponseCode.RETRY.getCode();\n        } catch (EdgeSocketConnectorException connectorException) {\n            if (isDecryptionError(connectorException)) {\n                log.warn(\n                        \"Decryption failed for batchId={}, check secret_key configuration\",\n                        batchId,\n                        connectorException);\n                return EdgeSocketResponseCode.DECRYPT_FAILED.getCode();\n            }\n            log.warn(\"Decode ingress packet failed for batchId={}\", batchId, connectorException);\n            return EdgeSocketResponseCode.DECODE_FAILED.getCode();\n        } catch (Exception decodeException) {\n            log.warn(\"Decode or enqueue ingress packet failed\", decodeException);\n            return EdgeSocketResponseCode.DECODE_FAILED.getCode();\n        }\n    }\n\n    @Override\n    public String handleCommitRequest(long batchId) {\n        synchronized (stateLock) {\n            return sourceState.resolveCommitResponse(batchId);\n        }\n    }\n\n    private boolean isDecryptionError(EdgeSocketConnectorException exception) {\n        EdgeSocketConnectorErrorCode errorCode =\n                (EdgeSocketConnectorErrorCode) exception.getSeaTunnelErrorCode();\n        return errorCode == EdgeSocketConnectorErrorCode.PACKET_AES_KEY_MISSING","sourceCodeStart":190,"sourceCodeEnd":226,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketSourceReader.java#L190-L226","documentation":"WARN log in handleBatchRecord for any EdgeSocketConnectorException that is NOT a decryption error: the ingress packet could not be decoded (framing/serialization failure). The batch is rejected with the DECODE_FAILED response code and the sender is expected to fix and resend or drop the batch.","triggerScenarios":"handleBatchRecord decode step throws EdgeSocketConnectorException with a non-decryption cause — malformed wire format, unsupported serialization type, truncated packet, protocol version mismatch.","commonSituations":"Edge client upgraded to a newer wire protocol the connector doesn't understand; partial reads / corrupted TCP stream framing; sender writing plain JSON where connector expects its binary format (or vice versa); buggy device firmware producing malformed batches.","solutions":["Check the logged stack trace to identify the decode stage that failed (header parse vs payload deserialize)","Align the sender's serialization format/protocol version with the connector's expected packet format","Re-snapshot the batch at the device: truncated packets usually indicate a sender-side write that was cut short","Upgrade or roll back connector/client versions so both sides speak the same wire protocol","Send a known-good sample batch from a test client to validate the path end to end"],"exampleFix":"// before: sender uses incompatible format\nclient.send(payloadBytes, Format.JSON);\n// after: match connector's expected format\nclient.send(packetCodec.encode(batch), Format.CONNECTOR_V1);","handlingStrategy":"retry","validationCode":"// sender-side: validate packet framing before send\nif (payload == null || payload.length == 0) throw new IllegalArgumentException(\"empty batch payload\");","typeGuard":null,"tryCatchPattern":"// on DECODE_FAILED, do not blind-retry the same bytes; re-encode once\nif (\"DECODE_FAILED\".equals(responseCode)) {\n    byte[] reEncoded = packetCodec.encode(batch);\n    client.sendBatch(batchId, reEncoded);\n}","preventionTips":["Pin sender and connector to compatible protocol versions","Integration-test wire format against a real connector instance on upgrades","Use length-prefixed framing to avoid truncated packets","Monitor decode failure counts per device to catch firmware regressions"],"tags":["decode","serialization","packet-format","socket-source"],"backgroundTag":"json-decode-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}