{"record":{"id":"1cb5f36559715999","repo":"apache/hadoop","slug":"directory-dir-is-in-an-inconsistent-state-messa","errorCode":null,"errorMessage":"Directory {dir} is in an inconsistent state: Message digest property imageMD5Digest not set for storage directory {root}","messagePattern":"Directory (.+?) is in an inconsistent state: Message digest property imageMD5Digest not set for storage directory (.+?)","errorType":"exception","errorClass":"org.apache.hadoop.hdfs.server.common.InconsistentFSStateException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java","lineNumber":818,"sourceCode":"      FSImageFile imageFile, StartupOption startupOption) throws IOException {\n    LOG.info(\"Planning to load image: \" + imageFile);\n    StorageDirectory sdForProperties = imageFile.sd;\n    storage.readProperties(sdForProperties, startupOption);\n\n    if (NameNodeLayoutVersion.supports(\n        LayoutVersion.Feature.TXID_BASED_LAYOUT, getLayoutVersion())) {\n      // For txid-based layout, we should have a .md5 file\n      // next to the image file\n      boolean isRollingRollback = RollingUpgradeStartupOption.ROLLBACK\n          .matches(startupOption);\n      loadFSImage(imageFile.getFile(), target, recovery, isRollingRollback);\n    } else if (NameNodeLayoutVersion.supports(\n        LayoutVersion.Feature.FSIMAGE_CHECKSUM, getLayoutVersion())) {\n      // In 0.22, we have the checksum stored in the VERSION file.\n      String md5 = storage.getDeprecatedProperty(\n          NNStorage.DEPRECATED_MESSAGE_DIGEST_PROPERTY);\n      if (md5 == null) {\n        throw new InconsistentFSStateException(sdForProperties.getRoot(),\n            \"Message digest property \" +\n            NNStorage.DEPRECATED_MESSAGE_DIGEST_PROPERTY +\n            \" not set for storage directory \" + sdForProperties.getRoot());\n      }\n      loadFSImage(imageFile.getFile(), new MD5Hash(md5), target, recovery,\n          false);\n    } else {\n      // We don't have any record of the md5sum\n      loadFSImage(imageFile.getFile(), null, target, recovery, false);\n    }\n  }\n\n  public void initEditLog(StartupOption startOpt) throws IOException {\n    Preconditions.checkState(getNamespaceID() != 0,\n        \"Must know namespace ID before initting edit log\");\n    String nameserviceId = DFSUtil.getNamenodeNameServiceId(conf);\n    if (!HAUtil.isHAEnabled(conf, nameserviceId)) {\n      // If this NN is not HA","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImage.java#L800-L836","documentation":"For storage written in the 0.22-era layout (FSIMAGE_CHECKSUM supported, before TXID_BASED_LAYOUT), the fsimage's MD5 is stored not in a sidecar .md5 file but as the imageMD5Digest property in the VERSION file. loadFSImageFile() found that property missing, meaning the storage directory state is inconsistent (hand-edited, partially copied, or damaged VERSION), and throws InconsistentFSStateException.","triggerScenarios":"Loading a 0.22-format storage dir whose VERSION lacks imageMD5Digest: VERSION rebuilt by hand, copied incompletely, or restored from the wrong sibling; salvaged disks with partial metadata.","commonSituations":"Manual metadata surgery on very old clusters; backups that skipped the VERSION file; pre-0.23 namespaces revived for migration.","solutions":["Restore the original VERSION file for that storage dir from a backup or sibling directory (all dirs from one namespace share these values).","If the fsimage itself is trusted, recompute and append the digest: md5sum fsimage_N, then add the line imageMD5Digest=<value> to VERSION (recovery-only measure).","Prefer regenerating a fresh checkpoint from a healthy node over hand-editing VERSION."],"exampleFix":"# before: VERSION (0.22 layout) has no imageMD5Digest line\n\n# after\nMD5=$(md5sum /dfs/nn/current/fsimage_* | awk '{print $1}')\necho \"imageMD5Digest=$MD5\" >> /dfs/nn/current/VERSION","handlingStrategy":"validation","validationCode":"Properties p = new Properties();\ntry (InputStream is = Files.newInputStream(versionFile)) {\n  p.load(is);\n}\nif (p.getProperty(NNStorage.DEPRECATED_MESSAGE_DIGEST_PROPERTY) == null) {\n  // 0.22-era dir with incomplete VERSION — restore or repair before startup\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always copy VERSION together with fsimage/edits when moving metadata.","Prefer modern layouts (sidecar .md5) by upgrading old namespaces.","Never hand-rebuild VERSION from memory — copy it from a sibling directory."],"tags":["hdfs","namenode","fsimage","checksum","version-file","migration"],"backgroundTag":"fsimage-checksum-mismatch","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}