apache/hadoop · error · IllegalArgumentException

sourcePaths.size() + " source paths are provided"

Error message

sourcePaths.size() + " source paths are provided"

What it means

Error "sourcePaths.size() + " source paths are provided"" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-distcp/src/main/java/org/apache/hadoop/tools/DistCpSync.java:99

  private boolean isRdiff() {
    return context.shouldUseRdiff();
  }

  /**
   * Check if three conditions are met before sync.
   * 1. Only one source directory.
   * 2. Both source and target file system are DFS or WebHdfs.
   * 3. There is no change between from and the current status in target
   *    file system.
   *  Throw exceptions if first two aren't met, and return false to fallback to
   *  default distcp if the third condition isn't met.
   */
  private boolean preSyncCheck() throws IOException {
    List<Path> sourcePaths = context.getSourcePaths();
    if (sourcePaths.size() != 1) {
      // we only support one source dir which must be a snapshottable directory
      throw new IllegalArgumentException(sourcePaths.size()
          + " source paths are provided");
    }
    final Path sourceDir = sourcePaths.get(0);
    final Path targetDir = context.getTargetPath();

    final FileSystem srcFs = sourceDir.getFileSystem(conf);
    final FileSystem tgtFs = targetDir.getFileSystem(conf);
    final FileSystem snapshotDiffFs = isRdiff() ? tgtFs : srcFs;
    final Path snapshotDiffDir = isRdiff() ? targetDir : sourceDir;

    checkFilesystemSupport(sourceDir,targetDir,srcFs, tgtFs);

    // make sure targetFS has no change between from and the current states
    if (!checkNoChange(tgtFs, targetDir)) {
      // set the source path using the snapshot path
      context.setSourcePaths(Arrays.asList(getSnapshotPath(sourceDir,
          context.getToSnapshot())));
      return false;

View on GitHub (pinned to 2add963021)

Solutions

  1. Provide the correct number of source paths expected by the sync operation.
  2. Check the command-line parsing and source listing file.

When it happens

Trigger: DistCpSync receives an unexpected number of source paths.

Common situations: See trigger scenarios.


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