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
- Verify the source exists (fs.exists(src)) before renaming, or make the rename idempotent (skip if dst already exists)
- Fix the configured source path
- Check whether a previous run/attempt already consumed or moved the file
- 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
- Verify source existence before rename
- Check for prior attempts that already moved the file
- Log the exact absolute paths used to catch typos/case mismatches
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
- SftpException wrapped (pwd failed while renaming)
- Destination path %s already exist, cannot rename!
- Path %s is a directory.
- Path ${file} is a directory.
- FTP directory does not exist: ${mask(absolute)}
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/3d521a281b7bbbcc.
Report an issue: GitHub.