apache/seatunnel · error · FileNotFoundException
Source path %s does not exist
Error message
Source path %s does not exist
What it means
During rename, SeaTunnelFTPFileSystem first absolutizes the source and destination paths against the FTP working directory, then verifies the source exists. If it does not, a FileNotFoundException with 'Source path %s does not exist' is thrown instead of attempting an FTP RENAME that would fail opaquely.
Source
Thrown at seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java:834
}
/**
* Convenience method, so that we don't open a new connection when using this method from within
* another method. Otherwise every API invocation incurs the overhead of opening/closing a TCP
* connection.
*
* @param client FTPClient
* @param src src
* @param dst dst
* @return result
* @throws IOException IOException
*/
private boolean rename(FTPClient client, Path src, Path dst) throws IOException {
Path workDir = new Path(client.printWorkingDirectory());
Path absoluteSrc = makeAbsolute(workDir, src);
Path absoluteDst = makeAbsolute(workDir, dst);
if (!exists(client, absoluteSrc)) {
throw new FileNotFoundException("Source path " + src + " does not exist");
}
if (isDirectory(absoluteDst)) {
// destination is a directory: rename goes underneath it with the
// source name
absoluteDst = new Path(absoluteDst, absoluteSrc.getName());
}
if (exists(client, absoluteDst)) {
throw new FileAlreadyExistsException("Destination path " + dst + " already exists");
}
if (isParentOf(absoluteSrc, absoluteDst)) {
throw new IOException(
"Cannot rename " + absoluteSrc + " under itself" + " : " + absoluteDst);
}
String from = absoluteSrc.toUri().getPath();
String to = absoluteDst.toUri().getPath();
return client.rename(from, to);
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Verify the source path exists on the FTP server (ls the parent directory) and matches case exactly
- Check whether the file was consumed/deleted by a prior job or another concurrent process
- Confirm the FTP user's home/working directory matches your assumption; use absolute paths starting with '/'
- Ensure the upstream step that creates the file completed successfully before rename runs
- If using relative paths, log client.printWorkingDirectory() at job start to see the resolution base
Example fix
// before
ftpFileSystem.rename(new Path("Data/file.txt"), dst); // wrong case
// after
Path src = new Path("/data/file.txt");
if (!ftpFileSystem.exists(src)) {
throw new FileNotFoundException("Pre-check failed: " + src);
}
ftpFileSystem.rename(src, dst); Defensive patterns
Strategy: validation
Validate before calling
// Java: pre-check source existence before rename
Path src = new Path("/data/file.txt");
if (!ftpFileSystem.exists(src)) {
throw new FileNotFoundException("Rename aborted, missing source: " + src);
} Try / catch
try {
fs.rename(src, dst);
} catch (FileNotFoundException e) {
logger.warn("Rename source missing (already moved/consumed?): {}", src);
} Prevention
- Always use absolute FTP paths
- Check that upstream steps that create the file completed successfully
- Avoid concurrent jobs moving the same files
- Remember FTP paths are case-sensitive
When it happens
Trigger: rename(client, src, dst) is called and exists(client, absoluteSrc) returns false — the source path (made absolute against client.printWorkingDirectory()) is not present on the FTP server.
Common situations: Typo or wrong case in the source path (FTP paths are case-sensitive); file was already moved/deleted by another process or a previous job run; relative path resolved against an unexpected working directory; staging/temp file was never written because an earlier step failed.
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
- File ${file} does not exist.
- Destination path %s already exists
- Cannot rename %s under itself : %s
- AmazonDocumentDB TLS CA bundle is not a readable file:
- clickhouse local file not exists
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/0cf4e818d1201f57.
Report an issue: GitHub.