{"record":{"id":"39cc173e18ca45a4","repo":"apache/hadoop","slug":"attempted-to-seek-or-read-past-the-end-of-the-file-39cc17","errorCode":null,"errorMessage":"Attempted to seek or read past the end of the file","messagePattern":"Attempted to seek or read past the end of the file","errorType":"exception","errorClass":"EOFException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/OSSDataBlocks.java","lineNumber":802,"sourceCode":"        }\n\n        public synchronized int read() throws IOException {\n          if (available() > 0) {\n            return byteBuffer.get() & 0xFF;\n          } else {\n            return -1;\n          }\n        }\n\n        @Override\n        public synchronized long skip(long offset) throws IOException {\n          verifyOpen();\n          long newPos = position() + offset;\n          if (newPos < 0) {\n            throw new EOFException(FSExceptionMessages.NEGATIVE_SEEK);\n          }\n          if (newPos > size) {\n            throw new EOFException(FSExceptionMessages.CANNOT_SEEK_PAST_EOF);\n          }\n          byteBuffer.position((int) newPos);\n          return newPos;\n        }\n\n        @Override\n        public synchronized int available() {\n          Preconditions.checkState(byteBuffer != null,\n              FSExceptionMessages.STREAM_IS_CLOSED);\n          return byteBuffer.remaining();\n        }\n\n        /**\n         * Get the current buffer position.\n         * @return the buffer position\n         */\n        public synchronized int position() {\n          return byteBuffer.position();","sourceCodeStart":784,"sourceCodeEnd":820,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/OSSDataBlocks.java#L784-L820","documentation":"Error \"Attempted to seek or read past the end of the file\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-tools/hadoop-aliyun/src/main/java/org/apache/hadoop/fs/aliyun/oss/OSSDataBlocks.java:802 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep the requested position within the file length; check the file size before seeking or reading past the end."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}