{"record":{"id":"1286e50300d1d2df","repo":"apache/hadoop","slug":"no-targets-in-destination-storage","errorCode":null,"errorMessage":"No targets in destination storage!","messagePattern":"No targets in destination storage!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java","lineNumber":120,"sourceCode":"  \n  public static void downloadMostRecentImageToDirectory(URL infoServer,\n      File dir) throws IOException {\n    String fileId = ImageServlet.getParamStringForMostRecentImage();\n    getFileClient(infoServer, fileId, Lists.newArrayList(dir),\n        null, false);\n  }\n\n  public static MD5Hash downloadImageToStorage(URL fsName, long imageTxId,\n      Storage dstStorage, boolean needDigest, boolean isBootstrapStandby)\n      throws IOException {\n    String fileid = ImageServlet.getParamStringForImage(null,\n        imageTxId, dstStorage, isBootstrapStandby);\n    String fileName = NNStorage.getCheckpointImageFileName(imageTxId);\n    \n    List<File> dstFiles = dstStorage.getFiles(\n        NameNodeDirType.IMAGE, fileName);\n    if (dstFiles.isEmpty()) {\n      throw new IOException(\"No targets in destination storage!\");\n    }\n    \n    MD5Hash hash = getFileClient(fsName, fileid, dstFiles, dstStorage, needDigest);\n    LOG.info(\"Downloaded file \" + dstFiles.get(0).getName() + \" size \" +\n        dstFiles.get(0).length() + \" bytes.\");\n    return hash;\n  }\n\n  static MD5Hash handleUploadImageRequest(HttpServletRequest request,\n      long imageTxId, Storage dstStorage, InputStream stream,\n      long advertisedSize, DataTransferThrottler throttler) throws IOException {\n\n    String fileName = NNStorage.getCheckpointImageFileName(imageTxId);\n\n    List<File> dstFiles = dstStorage.getFiles(NameNodeDirType.IMAGE, fileName);\n    if (dstFiles.isEmpty()) {\n      throw new IOException(\"No targets in destination storage!\");\n    }","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/TransferFsImage.java#L102-L138","documentation":"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'.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Configure at least one IMAGE-capable directory: dfs.namenode.name.dir on the standby / dfs.namenode.checkpoint.dir on the 2NN","Verify the property names and paths in hdfs-site.xml on the node running the download","Ensure the directories exist and are writable by the NameNode user","Re-run 'hdfs namenode -bootstrapStandby' (or restart the 2NN) after fixing configuration"],"exampleFix":"<!-- before: no local image dir on standby -->\n<property><name>dfs.namenode.shared.edits.dir</name><value>qjournal://host1:8485;host2:8485/ns1</value></property>\n<!-- after -->\n<property><name>dfs.namenode.name.dir</name><value>file:///data/dfs/name</value></property>\n<property><name>dfs.namenode.shared.edits.dir</name><value>qjournal://host1:8485;host2:8485/ns1</value></property>","handlingStrategy":"validation","validationCode":"// must yield at least one IMAGE dir before any download\nString[] nameDirs = conf.getTrimmedStrings(DFSConfigKeys.DFS_NAMENODE_NAME_DIR_KEY);\nif (nameDirs.length == 0) {\n  throw new IOException(\"No dfs.namenode.name.dir configured — \"\n      + \"downloadImageToStorage would fail with 'No targets in destination storage!'\");\n}\n// or directly against the storage object:\nif (dstStorage.getFiles(NameNodeDirType.IMAGE,\n        NNStorage.getCheckpointImageFileName(txId)).isEmpty()) {\n  throw new IOException(\"Destination storage has no IMAGE directory\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  TransferFsImage.downloadImageToStorage(fsName, txId, dstStorage, true, true);\n} catch (IOException e) { // \"No targets in destination storage!\"\n  // configuration bug, not transient: fix name/checkpoint dirs and re-bootstrap\n}","preventionTips":["Validate hdfs-site.xml contains dfs.namenode.name.dir (standby) / dfs.namenode.checkpoint.dir (2NN) in your pre-deploy lint","Bootstrap standby nodes only from templates that carry the full HA config set","Smoke-test '-bootstrapStandby' on freshly provisioned nodes to catch missing-dir config early"],"tags":["hdfs","namenode","transferfsimage","bootstrap-standby","missing-configuration","storage"],"backgroundTag":"missing-storage-directory","analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}