apache/hadoop · error · IOException

Expected block file at ${f} does not exist.

Error message

Expected block file at ${f} does not exist.

What it means

Error "Expected block file at ${f} does not exist." thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/LocalReplica.java:440

  /**
   * Get input stream for a local file and optionally seek to the offset.
   * @param f path to the file
   * @param seekOffset offset to seek
   * @return input stream for read
   * @throws IOException
   */
  private FileInputStream getDataInputStream(File f, long seekOffset)
      throws IOException {
    FileInputStream fis;
    final FileIoProvider fileIoProvider = getFileIoProvider();
    if (NativeIO.isAvailable()) {
      fis = fileIoProvider.getShareDeleteFileInputStream(
          getVolume(), f, seekOffset);
    } else {
      try {
        fis = fileIoProvider.openAndSeek(getVolume(), f, seekOffset);
      } catch (FileNotFoundException fnfe) {
        throw new IOException("Expected block file at " + f +
            " does not exist.");
      }
    }
    return fis;
  }

  /**
   *  Get pin status of a file by checking the sticky bit.
   * @param localFS local file system
   * @param path path to be checked
   * @return true if the file is pinned with sticky bit
   * @throws IOException
   */
  public boolean getPinning(LocalFileSystem localFS, Path path) throws
      IOException {
    boolean stickyBit =
        localFS.getFileStatus(path).getPermission().getStickyBit();
    return stickyBit;

View on GitHub (pinned to 2add963021)

Solutions

  1. Check whether the block file was deleted out-of-band or the volume failed; run a volume check (the DataNode's DatasetVolumeChecker should mark the volume failed).
  2. If the replica is gone, report the block as missing so the NameNode re-replicates it; restore from another replica if needed.

When it happens

Trigger: A block file expected at a given path is missing on disk, e.g., after manual deletion, volume failure, or filesystem corruption.

Common situations: The expected block data file is missing from disk, pointing to deletion outside HDFS or disk failure. Run fsck and check the volume for errors.


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