apache/hadoop · error · IOException

Offset={} out of the range [0, {}); {}, path={}

Error message

Offset={} out of the range [0, {}); {}, path={}

What it means

Error "Offset={} out of the range [0, {}); {}, path={}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java:328

          LOG.debug("DataNode {} was requested to be excluded, "
                + "but it was not found.", host);
        }
      }
    }

    // For these operations choose a datanode containing a replica
    if (op == GetOpParam.Op.OPEN
        || op == GetOpParam.Op.GETFILECHECKSUM
        || op == PostOpParam.Op.APPEND) {
      final NamenodeProtocols np = getRPCServer(namenode);
      if (status == null) {
        throw new FileNotFoundException("File " + path + " not found.");
      }

      final long len = status.getLen();
      if (op == GetOpParam.Op.OPEN) {
        if (openOffset < 0L || (openOffset >= len && len > 0)) {
          throw new IOException("Offset=" + openOffset
              + " out of the range [0, " + len + "); " + op + ", path=" + path);
        }
      }

      if (len > 0) {
        final long offset = op == GetOpParam.Op.OPEN? openOffset: len - 1;
        final LocatedBlocks locations = np.getBlockLocations(path, offset, 1);
        final int count = locations.locatedBlockCount();
        if (count > 0) {
          return bestNode(locations.get(0).getLocations(), excludes);
        } else {
          throw new IOException("Block could not be located. Path=" + path + ", offset=" + offset);
        }
      }
    }

    // All other operations don't affect a specific node so let the BlockManager pick a target
    DatanodeDescriptor clientNode = bm.getDatanodeManager(

View on GitHub (pinned to 2add963021)

Solutions

  1. Request an offset within [0, fileLength); adjust the offset parameter of the read.

When it happens

Trigger: A WebHDFS read specifies an offset outside the file's valid byte range.

Common situations: Seeking past end-of-file or using a negative offset in an open/read request.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/0d376fde748e1372. Report an issue: GitHub.