{"record":{"id":"e2b59d6164bd77a5","repo":"apache/flink","slug":"could-not-skip-bytes","errorCode":null,"errorMessage":"Could not skip {} bytes.","messagePattern":"Could not skip (.+?) bytes\\.","errorType":"exception","errorClass":"EOFException","httpStatus":null,"severity":"error","filePath":"flink-core/src/main/java/org/apache/flink/types/Record.java","lineNumber":1836,"sourceCode":"                        \"Serialization failed because the record length would exceed 2GB.\");\n            }\n        }\n\n        @SuppressWarnings(\"restriction\")\n        private static final sun.misc.Unsafe UNSAFE = MemoryUtils.UNSAFE;\n\n        @SuppressWarnings(\"restriction\")\n        private static final long BASE_OFFSET = UNSAFE.arrayBaseOffset(byte[].class);\n\n        private static final boolean LITTLE_ENDIAN =\n                (MemoryUtils.NATIVE_BYTE_ORDER == ByteOrder.LITTLE_ENDIAN);\n\n        @Override\n        public void skipBytesToWrite(int numBytes) throws IOException {\n            int skippedBytes = skipBytes(numBytes);\n\n            if (skippedBytes != numBytes) {\n                throw new EOFException(\"Could not skip \" + numBytes + \" bytes.\");\n            }\n        }\n\n        @Override\n        public void write(DataInputView source, int numBytes) throws IOException {\n            if (numBytes > this.end - this.position) {\n                throw new IOException(\n                        \"Could not write \" + numBytes + \" bytes since the buffer is full.\");\n            }\n\n            source.readFully(this.memory, this.position, numBytes);\n            this.position += numBytes;\n        }\n    }\n}\n","sourceCodeStart":1818,"sourceCodeEnd":1852,"githubUrl":"https://github.com/apache/flink/blob/2f3c205e9266cb30240eb7f4fdab15cad629a70f/flink-core/src/main/java/org/apache/flink/types/Record.java#L1818-L1852","documentation":"Thrown by skipBytesToWrite(int numBytes), a splicing helper on Record's serialization views. It first calls skipBytes(numBytes) on the input view, which returns how many bytes were actually skipped; because the view is bounded by this.end, a request that runs past the end of the record's memory returns fewer bytes than asked, and the mismatch is reported as an EOFException.","triggerScenarios":"Calling skipBytesToWrite(n) on a deserialization input view where fewer than n bytes remain between the current position and this.end; typically during copy/splice operations between Record views that assume a fixed field width (e.g. skipping a variable-length field using a stale length).","commonSituations":"Copying data between Records with mismatched schemas or versions; a length-prefixed field whose declared length is larger than the actual serialized content; truncation/corruption of a record's binary buffer.","solutions":["Verify the remaining bytes: skip only Math.min(numBytes, availableBytes) where availableBytes = end - position","Check that the field length you computed matches what was written (same writer schema/version on both sides)","If records may be truncated, guard the splice path with a bounds check and reject the record explicitly"],"exampleFix":"// before\ninput.skipBytesToWrite(fieldLen); // may hit end of view\n\n// after\nint remaining = end - position; // or expose available()\ninput.skipBytesToWrite(Math.min(fieldLen, remaining));","handlingStrategy":"validation","validationCode":"int available = end - position; // expose or compute remaining bytes in the view\ninput.skipBytesToWrite(Math.min(numBytes, available));","typeGuard":null,"tryCatchPattern":"catch (EOFException e) { // record truncated: reject and skip to next }","preventionTips":["Match skip lengths to the writer's field lengths","Validate record binary length before splicing","Treat EOF during splice as data corruption, not a retryable error"],"tags":["flink","serialization","record","eof","bounds-check"],"backgroundTag":null,"analyzedSha":"2f3c205e9266cb30240eb7f4fdab15cad629a70f","analyzedAt":"2026-08-14T08:48:24.518Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}