apache/seatunnel · error · IOException

Unable to create file: ${file}, Aborting

Error message

Unable to create file: ${file}, Aborting

What it means

Thrown by SeaTunnelFTPFileSystem.create() after opening the FTP output stream: the initial reply code from the server was not a positive preliminary (1xx), meaning the server did not accept the file-creation (STOR/STOU) command. The stream is closed and an IOException is thrown because the FTP client is in an inconsistent state.

Source

Thrown at seatunnel-connectors-v2/connector-file/connector-file-ftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/ftp/system/SeaTunnelFTPFileSystem.java:399

                    public void close() throws IOException {
                        super.close();
                        if (!client.isConnected()) {
                            throw new FTPException("Client not connected");
                        }
                        boolean cmdCompleted = client.completePendingCommand();
                        disconnect(client);
                        if (!cmdCompleted) {
                            throw new FTPException(
                                    "Could not complete transfer, Reply Code - "
                                            + client.getReplyCode());
                        }
                    }
                };
        if (!FTPReply.isPositivePreliminary(client.getReplyCode())) {
            // The ftpClient is an inconsistent state. Must close the stream
            // which in turn will logout and disconnect from FTP server
            fos.close();
            throw new IOException("Unable to create file: " + file + ", Aborting");
        }
        return fos;
    }

    /** This optional operation is not yet supported. */
    @Override
    public FSDataOutputStream append(Path f, int bufferSize, Progressable progress)
            throws IOException {
        throw new IOException("Not supported");
    }

    /**
     * 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.
     *
     * @throws IOException on IO problems other than FileNotFoundException
     */

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the parent directory of the target path exists on the FTP server (create it first or use mkdirs)
  2. Confirm the FTP user has write permission on the target directory
  3. Check the FTP reply code in server logs (e.g. 553, 421, 530) for the exact rejection cause
  4. Validate the configured remote root/path in the SeaTunnel FTP connector config
  5. If the server limits concurrent connections, reduce parallelism (e.g. job parallelism) or raise the server limit

Example fix

// before
FSDataOutputStream out = fs.create(new Path("/data/output.txt"));
// after
Path dir = new Path("/data");
if (!fs.exists(dir)) {
    fs.mkdirs(dir);
}
FSDataOutputStream out = fs.create(new Path("/data/output.txt"));
Defensive patterns

Strategy: validation

Validate before calling

Path dir = path.getParent();
if (!fs.exists(dir)) { fs.mkdirs(dir); }
// confirm credentials allow writes by testing a temp file

Try / catch

try {
    FSDataOutputStream out = fs.create(path);
} catch (IOException e) {
    if (e.getMessage().startsWith("Unable to create file")) {
        // inspect FTP reply code / permissions before retrying
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling fs.create(path) when the FTP server replies negatively to the store command — e.g. the path is invalid, the target directory does not exist, the user lacks write permission, or the server refuses a new transfer (max connections reached).

Common situations: Writing to a directory path that doesn't exist on the FTP server; read-only FTP credentials configured in the SeaTunnel FTP file connector; FTP server connection limit exceeded; absolute vs relative path confusion (path resolves outside allowed root).

Understand the failure class

Background: "failed to write file", "Could not save figure", "Error saving remote file" — file write failed: causes and fixes across languages and libraries — this error's family across 38 libraries.

Related errors


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