{"record":{"id":"0d376fde748e1372","repo":"apache/hadoop","slug":"offset-out-of-the-range-0-path","errorCode":null,"errorMessage":"Offset={} out of the range [0, {}); {}, path={}","messagePattern":"Offset=(.+?) out of the range \\[0, (.+?)\\); (.+?), path=(.+?)","errorType":"http","errorClass":"IOException","httpStatus":403,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java","lineNumber":328,"sourceCode":"          LOG.debug(\"DataNode {} was requested to be excluded, \"\n                + \"but it was not found.\", host);\n        }\n      }\n    }\n\n    // For these operations choose a datanode containing a replica\n    if (op == GetOpParam.Op.OPEN\n        || op == GetOpParam.Op.GETFILECHECKSUM\n        || op == PostOpParam.Op.APPEND) {\n      final NamenodeProtocols np = getRPCServer(namenode);\n      if (status == null) {\n        throw new FileNotFoundException(\"File \" + path + \" not found.\");\n      }\n\n      final long len = status.getLen();\n      if (op == GetOpParam.Op.OPEN) {\n        if (openOffset < 0L || (openOffset >= len && len > 0)) {\n          throw new IOException(\"Offset=\" + openOffset\n              + \" out of the range [0, \" + len + \"); \" + op + \", path=\" + path);\n        }\n      }\n\n      if (len > 0) {\n        final long offset = op == GetOpParam.Op.OPEN? openOffset: len - 1;\n        final LocatedBlocks locations = np.getBlockLocations(path, offset, 1);\n        final int count = locations.locatedBlockCount();\n        if (count > 0) {\n          return bestNode(locations.get(0).getLocations(), excludes);\n        } else {\n          throw new IOException(\"Block could not be located. Path=\" + path + \", offset=\" + offset);\n        }\n      }\n    }\n\n    // All other operations don't affect a specific node so let the BlockManager pick a target\n    DatanodeDescriptor clientNode = bm.getDatanodeManager(","sourceCodeStart":310,"sourceCodeEnd":346,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java#L310-L346","documentation":"Error \"Offset={} out of the range [0, {}); {}, path={}\" thrown in apache/hadoop.","triggerScenarios":"A WebHDFS read specifies an offset outside the file's valid byte range.","commonSituations":"Seeking past end-of-file or using a negative offset in an open/read request.","solutions":["Request an offset within [0, fileLength); adjust the offset parameter of the read."],"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"}