apache/seatunnel · error · IOException

Login failed on server - %s, port - %d as user '%s', reply c

Error message

Login failed on server - %s, port - %d as user '%s', reply code: %d

What it means

During connect(), after establishing the control connection to the FTP server, SeaTunnelFTPFileSystem calls client.login(user, password). If the server rejects the credentials it throws IOException with the host, port, user and the FTP reply code. The reply code (e.g. 530) distinguishes bad credentials from other login rejections.

Source

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

        int port = conf.getInt(FS_FTP_HOST_PORT, FTP.DEFAULT_PORT);
        String user = conf.get(FS_FTP_USER_PREFIX + host);
        String password = conf.get(FS_FTP_PASSWORD_PREFIX + host);

        // Connect to the FTP server
        client.connect(host, port);
        int reply = client.getReplyCode();
        if (!FTPReply.isPositiveCompletion(reply)) {
            throw NetUtils.wrapException(
                    host,
                    port,
                    NetUtils.UNKNOWN_HOST,
                    0,
                    new ConnectException("Server response " + reply));
        }

        // Log in to the FTP server
        if (!client.login(user, password)) {
            throw new IOException(
                    String.format(
                            "Login failed on server - %s, port - %d as user '%s', reply code: %d",
                            host, port, user, client.getReplyCode()));
        }

        // Set the file type to binary and buffer size
        client.setFileType(FTP.BINARY_FILE_TYPE);
        client.setBufferSize(DEFAULT_BUFFER_SIZE);
        client.setFileTransferMode(FTP.BLOCK_TRANSFER_MODE);

        // Set the connection mode
        setFsFtpConnectionMode(client, connectionMode);

        // Log successful connection information
        LOG.info(
                String.format(
                        "Successfully connected to FTP server %s:%d in %s",
                        host, port, connectionMode));

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Verify the username/password in the URI (ftp://user:pass@host) or fs.ftp.user.<host>/fs.ftp.password.<host> configs
  2. Check the FTP server logs or reply code in the message: 530 typically means authentication rejected by the server
  3. Confirm the account is enabled and allowed to log in from the client's IP (allow/deny rules, FTP server policy)
  4. Test the same credentials with a standard FTP client (lftp/curl) to isolate SeaTunnel from the server

Example fix

// before
path = "ftp://admin:wrongpass@ftp.example.com/data"
// after
path = "ftp://admin:correctpass@ftp.example.com/data" // verified with lftp
Defensive patterns

Strategy: try-catch

Validate before calling

// Preflight login test before running the job
FTPClient c = new FTPClient();
c.connect(host, port);
boolean ok = c.login(user, password);
c.logout(); c.disconnect();
if (!ok) throw new IllegalStateException("FTP login rejected for user " + user + ", reply=" + c.getReplyCode());

Try / catch

try {
    return ftpFileSystem.connect();
} catch (IOException e) {
    if (e.getMessage() != null && e.getMessage().startsWith("Login failed")) {
        throw new AuthenticationException("Check FTP credentials/server policy: " + e.getMessage(), e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling connect() (directly or via client(), openFileStatusListingSession(), getHomeDirectory()) when the FTP server returns a negative reply to the LOGIN command for the configured user/password.

Common situations: Wrong password or username in URI userinfo / fs.ftp.user.<host> config; account locked or expired; FTP server restricts logins by IP; user lacks permission to log in (vs. later permission errors); anonymous login disallowed on the server.

Related errors


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