{"record":{"id":"309e5fb39aeab03b","repo":"apache/seatunnel","slug":"packet-decode-error","errorCode":"PACKET_DECODE_ERROR","errorMessage":"Payload decompression failed","messagePattern":"Payload decompression failed","errorType":"error_code","errorClass":"EdgeSocketConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/serialize/payload/EdgeSocketCompressionPayloadDeserializer.java","lineNumber":91,"sourceCode":"\n    /**\n     * Read all bytes from factory-created stream and map IO failures to connector error.\n     *\n     * @param inputStreamFactory stream factory for concrete compression implementation\n     * @return fully decompressed bytes\n     */\n    private byte[] readAll(InputStreamFactory inputStreamFactory) {\n        try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) {\n            try (InputStream inputStream = inputStreamFactory.create()) {\n                byte[] buffer = new byte[1024];\n                int len;\n                while ((len = inputStream.read(buffer)) != -1) {\n                    baos.write(buffer, 0, len);\n                }\n            }\n            return baos.toByteArray();\n        } catch (IOException ioException) {\n            throw new EdgeSocketConnectorException(\n                    EdgeSocketConnectorErrorCode.PACKET_DECODE_ERROR,\n                    \"Payload decompression failed\",\n                    ioException);\n        }\n    }\n\n    /** Lazily creates compression-specific input streams for payload decoding. */\n    private interface InputStreamFactory {\n        /**\n         * Create input stream for decompression.\n         *\n         * @return input stream over compressed payload\n         * @throws IOException if stream init fails\n         */\n        InputStream create() throws IOException;\n    }\n\n    private static class GZIPInputStreamWrapper implements InputStreamFactory {","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/serialize/payload/EdgeSocketCompressionPayloadDeserializer.java#L73-L109","documentation":"EdgeSocketCompressionPayloadDeserializer.readAll() reads the decompressed packet bytes from the input stream into a byte array. Any IOException while streaming (truncated gzip/zlib stream, corrupt checksum, unexpected EOF) is wrapped as EdgeSocketConnectorException with code PACKET_DECODE_ERROR and message 'Payload decompression failed'. The original IOException is attached as the cause.","triggerScenarios":"readAll() called from decompress() hits an IOException from the underlying GZIP/Inflater input stream — truncated payload, corrupted compressed bytes, or stream closed mid-read.","commonSituations":"Network truncation between sender and receiver, sender flushing incomplete compressed payloads, or a writer bug producing invalid gzip/zlib data.","solutions":["Check the attached IOException cause to confirm truncation vs corruption.","Verify the sender writes and flushes the complete compressed payload before closing.","Inspect network path (proxies, MTU, socket timeouts) for byte loss.","Re-run with the producer writing uncompressed ('none') to isolate the compressor."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    byte[] payload = readAll(inputStream);\n} catch (EdgeSocketConnectorException e) {\n    if (e.getErrorCode() == EdgeSocketConnectorErrorCode.PACKET_DECODE_ERROR && e.getCause() instanceof IOException) {\n        // log the truncated/corrupt packet and skip or reconnect\n    }\n}","preventionTips":["Ensure senders flush complete compressed payloads before closing the stream.","Monitor network links for truncation (proxies, idle timeouts).","Test with compression=none to isolate compressor vs network issues."],"tags":["deserialization","io","compression"],"backgroundTag":"file-read-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"}