{"record":{"id":"75e287bc92cfb391","repo":"apache/hadoop","slug":"position-behind-the-end-of-the-stream-length","errorCode":null,"errorMessage":"Position behind the end of the stream (length = {}): {}","messagePattern":"Position behind the end of the stream \\(length = (.+?)\\): (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java","lineNumber":1042,"sourceCode":"      @Override\n      public synchronized long getPos() throws IOException {\n        return (position - start);\n      }\n      \n      @Override\n      public synchronized void seek(final long pos) throws IOException {\n        validatePosition(pos);\n        position = start + pos;\n        underLyingStream.seek(position);\n      }\n\n      private void validatePosition(final long pos) throws IOException {\n        if (pos < 0) {\n          throw new IOException(\"Negative position: \"+pos);\n         }\n         final long length = end - start;\n         if (pos > length) {\n           throw new IOException(\"Position behind the end \" +\n               \"of the stream (length = \"+length+\"): \" + pos);\n         }\n      }\n\n      @Override\n      public boolean seekToNewSource(long targetPos) throws IOException {\n        // do not need to implement this\n        // hdfs in itself does seektonewsource\n        // while reading.\n        return false;\n      }\n      \n      /**\n       * implementing position readable. \n       */\n      @Override\n      public int read(long pos, byte[] b, int offset, int length) \n      throws IOException {","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java#L1024-L1060","documentation":"Error \"Position behind the end of the stream (length = {}): {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java:1042 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Seek to a position within the stream length.","Check the file length first and clamp the requested position."],"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"}