apache/dolphinscheduler · error · FileAlreadyExistsException

Destination path already exists: ${dstAbsolutePath}

Error message

Destination path already exists: ${dstAbsolutePath}

What it means

A precondition in copy(): the destination path already exists and overwrite=false, so the copy is refused rather than clobbering an existing file or directory. The offending input is dstAbsolutePath; it fires when moving/renaming a resource onto an occupied name or re-uploading to the same destination without the overwrite flag.

Source

Thrown at dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/local/LocalStorageOperator.java:103

            Files.deleteIfExists(Paths.get(resourceAbsolutePath));
        }
    }

    @SneakyThrows
    @Override
    public void copy(String srcAbsolutePath, String dstAbsolutePath, boolean deleteSource, boolean overwrite) {
        if (srcAbsolutePath.equals(dstAbsolutePath)) {
            throw new IllegalArgumentException(
                    "Source path and destination path cannot be the same: " + srcAbsolutePath);
        }

        if (!exists(srcAbsolutePath)) {
            throw new FileNotFoundException("Source path does not exist: " + srcAbsolutePath);
        }

        if (exists(dstAbsolutePath)) {
            if (!overwrite) {
                throw new FileAlreadyExistsException("Destination path already exists: " + dstAbsolutePath);
            }
            delete(dstAbsolutePath, true);
        }

        final File srcFile = new File(srcAbsolutePath);
        final File dstFile = new File(dstAbsolutePath);
        if (FileUtils.isDirectory(srcFile)) {
            FileUtils.copyDirectoryToDirectory(srcFile, dstFile);
        } else {
            FileUtils.copyFile(srcFile, dstFile);
        }
        if (deleteSource) {
            delete(srcAbsolutePath, true);
        }
    }

    @Override
    public void upload(String srcLocalFileAbsolutePath, String dstAbsolutePath, boolean deleteSource,

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Choose a different destination name, or delete the existing destination first
  2. Pass overwrite=true when overwriting is intended
  3. Pre-check existence in the caller (upload/rename flows) and surface a user-facing conflict message
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at dolphinscheduler-storage-plugin/dolphinscheduler-storage-api/src/main/java/org/apache/dolphinscheduler/plugin/storage/api/local/LocalStorageOperator.java:103 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/83a926226dd6c0b1. Report an issue: GitHub.