apache/hadoop · error · IOException

No targets in destination storage!

Error message

No targets in destination storage!

What it means

TransferFsImage.downloadImageToStorage() resolves destination files with dstStorage.getFiles(NameNodeDirType.IMAGE, fileName) and throws IOException when the list is empty — the destination Storage has not a single IMAGE-capable storage directory to write fsimage_<txid> into. Callers are the 2NN checkpoint download and 'hdfs namenode -bootstrapStandby'.

Source

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

  
  public static void downloadMostRecentImageToDirectory(URL infoServer,
      File dir) throws IOException {
    String fileId = ImageServlet.getParamStringForMostRecentImage();
    getFileClient(infoServer, fileId, Lists.newArrayList(dir),
        null, false);
  }

  public static MD5Hash downloadImageToStorage(URL fsName, long imageTxId,
      Storage dstStorage, boolean needDigest, boolean isBootstrapStandby)
      throws IOException {
    String fileid = ImageServlet.getParamStringForImage(null,
        imageTxId, dstStorage, isBootstrapStandby);
    String fileName = NNStorage.getCheckpointImageFileName(imageTxId);
    
    List<File> dstFiles = dstStorage.getFiles(
        NameNodeDirType.IMAGE, fileName);
    if (dstFiles.isEmpty()) {
      throw new IOException("No targets in destination storage!");
    }
    
    MD5Hash hash = getFileClient(fsName, fileid, dstFiles, dstStorage, needDigest);
    LOG.info("Downloaded file " + dstFiles.get(0).getName() + " size " +
        dstFiles.get(0).length() + " bytes.");
    return hash;
  }

  static MD5Hash handleUploadImageRequest(HttpServletRequest request,
      long imageTxId, Storage dstStorage, InputStream stream,
      long advertisedSize, DataTransferThrottler throttler) throws IOException {

    String fileName = NNStorage.getCheckpointImageFileName(imageTxId);

    List<File> dstFiles = dstStorage.getFiles(NameNodeDirType.IMAGE, fileName);
    if (dstFiles.isEmpty()) {
      throw new IOException("No targets in destination storage!");
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Configure at least one IMAGE-capable directory: dfs.namenode.name.dir on the standby / dfs.namenode.checkpoint.dir on the 2NN
  2. Verify the property names and paths in hdfs-site.xml on the node running the download
  3. Ensure the directories exist and are writable by the NameNode user
  4. Re-run 'hdfs namenode -bootstrapStandby' (or restart the 2NN) after fixing configuration

Example fix

<!-- before: no local image dir on standby -->
<property><name>dfs.namenode.shared.edits.dir</name><value>qjournal://host1:8485;host2:8485/ns1</value></property>
<!-- after -->
<property><name>dfs.namenode.name.dir</name><value>file:///data/dfs/name</value></property>
<property><name>dfs.namenode.shared.edits.dir</name><value>qjournal://host1:8485;host2:8485/ns1</value></property>
Defensive patterns

Strategy: validation

Validate before calling

// must yield at least one IMAGE dir before any download
String[] nameDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY);
if (nameDirs.length == 0) {
  throw new IOException("No dfs.namenode.name.dir configured — "
      + "downloadImageToStorage would fail with 'No targets in destination storage!'");
}
// or directly against the storage object:
if (dstStorage.getFiles(NameNodeDirType.IMAGE,
        NNStorage.getCheckpointImageFileName(txId)).isEmpty()) {
  throw new IOException("Destination storage has no IMAGE directory");
}

Try / catch

try {
  TransferFsImage.downloadImageToStorage(fsName, txId, dstStorage, true, true);
} catch (IOException e) { // "No targets in destination storage!"
  // configuration bug, not transient: fix name/checkpoint dirs and re-bootstrap
}

Prevention

When it happens

Trigger: Invoking downloadImageToStorage(fsName, imageTxId, dstStorage, …) with a dstStorage whose storage directories are all non-IMAGE typed or absent — dfs.namenode.checkpoint.dir unset/invalid on a SecondaryNameNode, or dfs.namenode.name.dir unset on a standby being bootstrapped while only dfs.namenode.shared.edits.dir exists.

Common situations: New standby node bootstrapped before its local name dirs were configured; hdfs-site.xml with a typo in the name/checkpoint dir keys; storage restricted to edits-only directories (shared edits journal only).

Related errors


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