apache/seatunnel · error · IOException

Source path %s does not exist

Error message

Source path %s does not exist

What it means

rename() checks exists(channel, absoluteSrc) and throws IOException(E_SPATH_NOTEXIST) if the source path is absent. It is a precondition failure: you asked to rename something that is not on the remote filesystem.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java:445

            if (!".".equalsIgnoreCase(fname) && !"..".equalsIgnoreCase(fname)) {
                fileStats.add(getFileStatus(client, entry, absolute));
            }
        }
        return fileStats.toArray(new FileStatus[fileStats.size()]);
    }

    private boolean rename(ChannelSftp channel, Path src, Path dst) throws IOException {
        Path workDir;
        try {
            workDir = new Path(channel.pwd());
        } catch (SftpException e) {
            throw new IOException(e);
        }
        Path absoluteSrc = makeAbsolute(workDir, src);
        Path absoluteDst = makeAbsolute(workDir, dst);

        if (!exists(channel, absoluteSrc)) {
            throw new IOException(String.format(E_SPATH_NOTEXIST, src));
        }
        if (exists(channel, absoluteDst)) {
            throw new IOException(String.format(E_DPATH_EXIST, dst));
        }
        boolean renamed = true;
        try {
            final String previousCwd = channel.pwd();
            channel.cd("/");
            channel.rename(src.toUri().getPath(), dst.toUri().getPath());
            channel.cd(previousCwd);
        } catch (SftpException e) {
            renamed = false;
        }
        return renamed;
    }

    @Override
    public void initialize(URI uriInfo, Configuration conf) throws IOException {

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the source exists (fs.exists(src)) before renaming, or make the rename idempotent (skip if dst already exists)
  2. Fix the configured source path
  3. Check whether a previous run/attempt already consumed or moved the file
  4. Ensure the producing step completed successfully before triggering the rename

Example fix

// before
fs.rename(src, dst);
// after
if (fs.exists(src)) {
    fs.rename(src, dst);
}
Defensive patterns

Strategy: validation

Validate before calling

if (!fs.exists(src)) {
    throw new IOException("Cannot rename, source missing: " + src);
}
if (fs.exists(dst)) {
    throw new IOException("Cannot rename, dst exists: " + dst);
}

Prevention

When it happens

Trigger: fs.rename(src, dst) where src was never created, was already moved/deleted, or the path spelling (relative vs absolute, case) differs from what exists on the server.

Common situations: Two-phase commit where the source file was already renamed by a previous attempt; typo in configured path; a prior job step silently failed to write the file; case-sensitivity mismatch.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/3d521a281b7bbbcc. Report an issue: GitHub.