apache/hadoop · error · PathExistsException

%s already exists

Error message

%s already exists

What it means

Error "%s already exists" thrown in apache/hadoop.

Source

Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/CopyFromLocalOperation.java:345

   * @throws FileAlreadyExistsException - If source is file and destination is path
   */
  private void checkDestination(
      Path dest,
      File src,
      boolean overwrite) throws PathExistsException,
      FileAlreadyExistsException {
    if (!getDestStatus().isPresent()) {
      return;
    }

    if (src.isDirectory() && getDestStatus().get().isFile()) {
      throw new FileAlreadyExistsException(
          "Source '" + src.getPath() + "' is directory and " +
              "destination '" + dest + "' is file");
    }

    if (!overwrite) {
      throw new PathExistsException(dest + " already exists");
    }
  }

  /**
   * Get the final path of a source file with regards to its destination.
   *
   * @param src - source path
   * @return - the final path for the source file to be uploaded to
   * @throws PathIOException - if a relative path can't be created
   */
  private Path getFinalPath(Path src) throws PathIOException {
    URI currentSrcUri = src.toUri();
    URI relativeSrcUri = source.toUri().relativize(currentSrcUri);
    if (relativeSrcUri.equals(currentSrcUri)) {
      throw new PathIOException("Cannot get relative path for URI:"
          + relativeSrcUri);
    }

View on GitHub (pinned to 2add963021)

Solutions

  1. Remove the existing destination first or enable overwrite for the copy operation.

When it happens

Trigger: Thrown at hadoop-tools/hadoop-aws/src/main/java/org/apache/hadoop/fs/s3a/impl/CopyFromLocalOperation.java:345 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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