apache/hadoop · critical · IOException

Image file is not found in {}

Error message

Image file is not found in {}

What it means

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.

Source

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

        in.close();
        in = null;
      } finally {
        IOUtils.cleanupWithLogger(LOG, in);
      }
    }
    return timeStamp;
  }

  @Override
  boolean isUpgradeFinalized() {
    return isUpgradeFinalized;
  }
    
  @Override
  List<FSImageFile> getLatestImages() throws IOException {
    // We should have at least one image and one edits dirs
    if (latestNameSD == null)
      throw new IOException("Image file is not found in " + imageDirs);
    if (latestEditsSD == null)
      throw new IOException("Edits file is not found in " + editsDirs);
    
    // Make sure we are loading image and edits from same checkpoint
    if (latestNameCheckpointTime > latestEditsCheckpointTime
        && latestNameSD != latestEditsSD
        && latestNameSD.getStorageDirType() == NameNodeDirType.IMAGE
        && latestEditsSD.getStorageDirType() == NameNodeDirType.EDITS) {
      // This is a rare failure when NN has image-only and edits-only
      // storage directories, and fails right after saving images,
      // in some of the storage directories, but before purging edits.
      // See -NOTE- in saveNamespace().
      LOG.error("This is a rare failure scenario!!!");
      LOG.error("Image checkpoint time " + latestNameCheckpointTime +
                " > edits checkpoint time " + latestEditsCheckpointTime);
      LOG.error("Name-node will treat the image as the latest state of " +
                "the namespace. Old edits will be discarded.");
    } else if (latestNameCheckpointTime != latestEditsCheckpointTime) {

View on GitHub (pinned to 2add963021)

Solutions

  1. Check every directory listed in dfs.namenode.name.dir for an fsimage file and its fsimage.md5
  2. Restore fsimage from backup or from the SecondaryNameNode's checkpoint directory, then start with -importCheckpoint
  3. If the directories are misconfigured, correct dfs.namenode.name.dir to the real storage location and restart
  4. If the namespace is disposable (dev), re-format: hdfs namenode -format

Example fix

<!-- before: name.dir points at an empty directory -->
<property><name>dfs.namenode.name.dir</name><value>/mnt/missing/name</value></property>
<!-- after: point at the directory that actually holds the fsimage -->
<property><name>dfs.namenode.name.dir</name><value>/dfs/name</value></property>
Defensive patterns

Strategy: validation

Validate before calling

for (URI u : FSNamesystem.getNamespaceDirs(conf)) {
  File f = new File(u.getPath(), "current/fsimage");
  if (!f.exists()) {
    LOG.error("no fsimage in " + f + " - NameNode will fail to start");
  }
}

Try / catch

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.

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


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