{"record":{"id":"39ac981dead74983","repo":"apache/hadoop","slug":"image-file-curfile-is-corrupt-with-md5-checksum","errorCode":null,"errorMessage":"Image file {curFile} is corrupt with MD5 checksum of {readImageMd5} but expecting {expectedMd5}","messagePattern":"Image file (.+?) is corrupt with MD5 checksum of (.+?) but expecting (.+?)","errorType":"exception","errorClass":"java.io.IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java","lineNumber":975,"sourceCode":"   * Load in the filesystem image from file. It's a big list of\n   * filenames and blocks.\n   */\n  private void loadFSImage(File curFile, MD5Hash expectedMd5,\n      FSNamesystem target, MetaRecoveryContext recovery,\n      boolean requireSameLayoutVersion) throws IOException {\n    // BlockPoolId is required when the FsImageLoader loads the rolling upgrade\n    // information. Make sure the ID is properly set.\n    target.setBlockPoolId(this.getBlockPoolID());\n\n    FSImageFormat.LoaderDelegator loader = FSImageFormat.newLoader(conf, target);\n    loader.load(curFile, requireSameLayoutVersion);\n\n    // Check that the image digest we loaded matches up with what\n    // we expected\n    MD5Hash readImageMd5 = loader.getLoadedImageMd5();\n    if (expectedMd5 != null &&\n        !expectedMd5.equals(readImageMd5)) {\n      throw new IOException(\"Image file \" + curFile +\n          \" is corrupt with MD5 checksum of \" + readImageMd5 +\n          \" but expecting \" + expectedMd5);\n    }\n\n    final long txId = setLastAppliedTxId(loader);\n    LOG.info(\"Loaded image for txid \" + txId + \" from \" + curFile);\n    storage.setMostRecentCheckpointInfo(txId, curFile.lastModified());\n  }\n\n  synchronized long setLastAppliedTxId(FSImageFormat.LoaderDelegator loader) {\n    lastAppliedTxId = loader.getLoadedImageTxId();\n    return lastAppliedTxId;\n  }\n\n  /**\n   * Save the contents of the FS image to the file.\n   */\n  void saveFSImage(SaveNamespaceContext context, StorageDirectory sd,","sourceCodeStart":957,"sourceCodeEnd":993,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L957-L993","documentation":"Error \"Image file {curFile} is corrupt with MD5 checksum of {readImageMd5} but expecting {expectedMd5}\" thrown in apache/hadoop.","triggerScenarios":"Loading an fsimage whose computed MD5 checksum does not match the expected checksum in the .md5 file, indicating corruption.","commonSituations":"See trigger scenarios.","solutions":["Discard the corrupt image and load from another storage directory or the peer NameNode.","Re-transfer the fsimage over a reliable channel and verify its MD5 matches."],"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"}