apache/hadoop · error · java.io.IOException

Image file {curFile} is corrupt with MD5 checksum of {readIm

Error message

Image file {curFile} is corrupt with MD5 checksum of {readImageMd5} but expecting {expectedMd5}

What it means

Error "Image file {curFile} is corrupt with MD5 checksum of {readImageMd5} but expecting {expectedMd5}" thrown in apache/hadoop.

Source

Thrown at hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java:975

   * Load in the filesystem image from file. It's a big list of
   * filenames and blocks.
   */
  private void loadFSImage(File curFile, MD5Hash expectedMd5,
      FSNamesystem target, MetaRecoveryContext recovery,
      boolean requireSameLayoutVersion) throws IOException {
    // BlockPoolId is required when the FsImageLoader loads the rolling upgrade
    // information. Make sure the ID is properly set.
    target.setBlockPoolId(this.getBlockPoolID());

    FSImageFormat.LoaderDelegator loader = FSImageFormat.newLoader(conf, target);
    loader.load(curFile, requireSameLayoutVersion);

    // Check that the image digest we loaded matches up with what
    // we expected
    MD5Hash readImageMd5 = loader.getLoadedImageMd5();
    if (expectedMd5 != null &&
        !expectedMd5.equals(readImageMd5)) {
      throw new IOException("Image file " + curFile +
          " is corrupt with MD5 checksum of " + readImageMd5 +
          " but expecting " + expectedMd5);
    }

    final long txId = setLastAppliedTxId(loader);
    LOG.info("Loaded image for txid " + txId + " from " + curFile);
    storage.setMostRecentCheckpointInfo(txId, curFile.lastModified());
  }

  synchronized long setLastAppliedTxId(FSImageFormat.LoaderDelegator loader) {
    lastAppliedTxId = loader.getLoadedImageTxId();
    return lastAppliedTxId;
  }

  /**
   * Save the contents of the FS image to the file.
   */
  void saveFSImage(SaveNamespaceContext context, StorageDirectory sd,

View on GitHub (pinned to 2add963021)

Solutions

  1. Discard the corrupt image and load from another storage directory or the peer NameNode.
  2. Re-transfer the fsimage over a reliable channel and verify its MD5 matches.

When it happens

Trigger: Loading an fsimage whose computed MD5 checksum does not match the expected checksum in the .md5 file, indicating corruption.

Common situations: See trigger scenarios.


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