{"record":{"id":"3ae67dbe1baffbb5","repo":"apache/hadoop","slug":"specified-a-directory-to-archive-with-no-contents","errorCode":null,"errorMessage":"Specified a directory to archive with no contents","messagePattern":"Specified a directory to archive with no contents","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/Client.java","lineNumber":800,"sourceCode":"        dstPath = new Path(dstPathBase, resource.getResourcePath())\n            .suffix(\".zip\");\n      } else {\n        dstPath = new Path(dstPathBase, srcFiles.get(0).getName());\n      }\n      FileSystem remoteFS = dstPath.getFileSystem(getConf());\n      LOG.info(\"Uploading resource \" + resource + \" from \" + srcPathString\n          + \" to \" + dstPath);\n      try (OutputStream outputStream = remoteFS.create(dstPath, true)) {\n        if (\"jar\".equals(srcScheme)) {\n          try (InputStream inputStream = new URL(srcPaths[0]).openStream()) {\n            IOUtils.copyBytes(inputStream, outputStream, getConf());\n          }\n        } else if (shouldArchive) {\n          List<File> filesToZip;\n          if (srcFiles.size() == 1 && srcFiles.get(0).isDirectory()) {\n            File[] childFiles = srcFiles.get(0).listFiles();\n            if (childFiles == null || childFiles.length == 0) {\n              throw new IllegalArgumentException(\n                  \"Specified a directory to archive with no contents\");\n            }\n            filesToZip = Lists.newArrayList(childFiles);\n          } else {\n            filesToZip = srcFiles;\n          }\n          ZipOutputStream zout = new ZipOutputStream(outputStream);\n          for (File fileToZip : filesToZip) {\n            addFileToZipRecursively(fileToZip.getParentFile(), fileToZip, zout);\n          }\n          zout.close();\n        } else {\n          try (InputStream inputStream = new FileInputStream(srcFiles.get(0))) {\n            IOUtils.copyBytes(inputStream, outputStream, getConf());\n          }\n        }\n      }\n      remoteFileStatus = remoteFS.getFileStatus(dstPath);","sourceCodeStart":782,"sourceCodeEnd":818,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-tools/hadoop-dynamometer/hadoop-dynamometer-infra/src/main/java/org/apache/hadoop/tools/dynamometer/Client.java#L782-L818","documentation":"Error \"Specified a directory to archive with no contents\" thrown in apache/hadoop.","triggerScenarios":"A directory specified for archiving in the dynamometer Client is empty, so there is nothing to zip into the archive.","commonSituations":"See trigger scenarios.","solutions":["Archive a directory that contains at least one file, or pick a different directory to archive."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}