{"record":{"id":"5032e805dab529b7","repo":"apache/hadoop","slug":"negative-position","errorCode":null,"errorMessage":"Negative position: {}","messagePattern":"Negative position: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java","lineNumber":1038,"sourceCode":"        // the return value should never be negative. \n        return 0;\n      }   \n      \n      @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. ","sourceCodeStart":1020,"sourceCodeEnd":1056,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java#L1020-L1056","documentation":"Error \"Negative position: {}\" thrown in apache/hadoop.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/fs/HarFileSystem.java:1038 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a non-negative position to seek.","Clamp the computed position to [0, length] before seeking."],"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"}