{"record":{"id":"7b8e8037e2a1ed9e","repo":"apache/hadoop","slug":"image-file-is-not-found-in","errorCode":null,"errorMessage":"Image file is not found in {}","messagePattern":"Image file is not found in (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java","lineNumber":155,"sourceCode":"        in.close();\n        in = null;\n      } finally {\n        IOUtils.cleanupWithLogger(LOG, in);\n      }\n    }\n    return timeStamp;\n  }\n\n  @Override\n  boolean isUpgradeFinalized() {\n    return isUpgradeFinalized;\n  }\n    \n  @Override\n  List<FSImageFile> getLatestImages() throws IOException {\n    // We should have at least one image and one edits dirs\n    if (latestNameSD == null)\n      throw new IOException(\"Image file is not found in \" + imageDirs);\n    if (latestEditsSD == null)\n      throw new IOException(\"Edits file is not found in \" + editsDirs);\n    \n    // Make sure we are loading image and edits from same checkpoint\n    if (latestNameCheckpointTime > latestEditsCheckpointTime\n        && latestNameSD != latestEditsSD\n        && latestNameSD.getStorageDirType() == NameNodeDirType.IMAGE\n        && latestEditsSD.getStorageDirType() == NameNodeDirType.EDITS) {\n      // This is a rare failure when NN has image-only and edits-only\n      // storage directories, and fails right after saving images,\n      // in some of the storage directories, but before purging edits.\n      // See -NOTE- in saveNamespace().\n      LOG.error(\"This is a rare failure scenario!!!\");\n      LOG.error(\"Image checkpoint time \" + latestNameCheckpointTime +\n                \" > edits checkpoint time \" + latestEditsCheckpointTime);\n      LOG.error(\"Name-node will treat the image as the latest state of \" +\n                \"the namespace. Old edits will be discarded.\");\n    } else if (latestNameCheckpointTime != latestEditsCheckpointTime) {","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java#L137-L173","documentation":"FSImagePreTransactionalStorageInspector analyzes legacy pre-transactional (pre-HDFS-1073, Hadoop 1.x-era) storage directories. getLatestImages() throws this IOException when, after scanning all configured name/edits directories, no storage directory contributed a usable fsimage (latestNameSD stays null). The NameNode has no starting point for the namespace and cannot boot.","triggerScenarios":"Starting a NameNode against pre-transactional-format storage where none of the dfs.namenode.name.dir / dfs.namenode.edits.dir directories contains an fsimage file: directories formatted EDITS-only, fsimage deleted, or the configured directories empty or wrong.","commonSituations":"Pointing dfs.namenode.name.dir at the wrong (empty) directory after a host or mount change; fsimage removed by an aggressive cleanup script; booting a legacy-format namespace with only edits present.","solutions":["Check every directory listed in dfs.namenode.name.dir for an fsimage file and its fsimage.md5","Restore fsimage from backup or from the SecondaryNameNode's checkpoint directory, then start with -importCheckpoint","If the directories are misconfigured, correct dfs.namenode.name.dir to the real storage location and restart","If the namespace is disposable (dev), re-format: hdfs namenode -format"],"exampleFix":"<!-- before: name.dir points at an empty directory -->\n<property><name>dfs.namenode.name.dir</name><value>/mnt/missing/name</value></property>\n<!-- after: point at the directory that actually holds the fsimage -->\n<property><name>dfs.namenode.name.dir</name><value>/dfs/name</value></property>","handlingStrategy":"validation","validationCode":"for (URI u : FSNamesystem.getNamespaceDirs(conf)) {\n  File f = new File(u.getPath(), \"current/fsimage\");\n  if (!f.exists()) {\n    LOG.error(\"no fsimage in \" + f + \" - NameNode will fail to start\");\n  }\n}","typeGuard":null,"tryCatchPattern":"catch IOException from FSImage#loadFSImage and surface the full imageDirs list in the operator message — the list in the exception text tells you which directories were scanned.","preventionTips":["Pre-flight every dfs.namenode.name.dir for an fsimage before starting the NameNode","Keep backups of name dirs (fsimage + fsimage.md5 + fstime) after each checkpoint","Automate config checks that compare configured dirs against actual disk contents"],"tags":["hadoop","hdfs","namenode","fsimage","storage-dir","legacy-format"],"backgroundTag":"missing-checkpoint-file","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-22T20:17:22.307Z"}