apache/seatunnel · error · IOException

Invalid host specified

Error message

Invalid host specified

What it means

SFTPFileSystem.setConfigurationFromURI requires an SFTP host, taken from the URI authority or the fs.sftp.host config. If both are absent it throws IOException with constant E_HOST_NULL = "Invalid host specified". Without a host the filesystem cannot open any SSH connection, so initialization fails fast.

Source

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

    public static final String E_DIR_CREATE_FROMFILE =
            "Can't make directory for path %s since it is a file.";
    public static final String E_MAKE_DIR_FORPATH =
            "Can't make directory for path \"%s\" under \"%s\".";
    public static final String E_DIR_NOTEMPTY = "Directory: %s is not empty.";
    public static final String E_FILE_CHECK_FAILED = "File check failed";
    public static final String E_NOT_SUPPORTED = "Not supported";
    public static final String E_SPATH_NOTEXIST = "Source path %s does not exist";
    public static final String E_DPATH_EXIST = "Destination path %s already exist, cannot rename!";
    public static final String E_FAILED_GETHOME = "Failed to get home directory";
    public static final String E_FAILED_DISCONNECT = "Failed to disconnect";

    private void setConfigurationFromURI(URI uriInfo, Configuration conf) throws IOException {

        // get host information from URI
        String host = uriInfo.getHost();
        host = (host == null) ? conf.get(FS_SFTP_HOST, null) : host;
        if (host == null) {
            throw new IOException(E_HOST_NULL);
        }
        conf.set(FS_SFTP_HOST, host);

        int port = uriInfo.getPort();
        port = (port == -1) ? conf.getInt(FS_SFTP_HOST_PORT, DEFAULT_SFTP_PORT) : port;
        conf.setInt(FS_SFTP_HOST_PORT, port);

        // get user/password information from URI
        String userAndPwdFromUri = uriInfo.getUserInfo();
        if (userAndPwdFromUri != null) {
            String[] userPasswdInfo = userAndPwdFromUri.split(":");
            String user = userPasswdInfo[0];
            user = URLDecoder.decode(user, "UTF-8");
            conf.set(FS_SFTP_USER_PREFIX + host, user);
            if (userPasswdInfo.length > 1) {
                conf.set(FS_SFTP_PASSWORD_PREFIX + host + "." + user, userPasswdInfo[1]);
            }
        }

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Include the host in the URI: sftp://myhost/path/to/file
  2. Or set conf.set("fs.sftp.host", "myhost") before initializing the filesystem
  3. Validate the URI authority string in your job config before submission

Example fix

// before
URI uri = URI.create("sftp:///data/input.csv"); // no host
// after
URI uri = URI.create("sftp://sftp.example.com/data/input.csv");
Defensive patterns

Strategy: validation

Validate before calling

URI u = jobUri;
if (u.getHost() == null && conf.get("fs.sftp.host") == null)
    throw new IllegalArgumentException("SFTP host missing: set URI authority or fs.sftp.host");

Prevention

When it happens

Trigger: initialize(uri, conf) called with a URI lacking a host (e.g. sftp:///path or sftp://) and Configuration has no fs.sftp.host property set.

Common situations: Constructing a Path/URI programmatically without the authority; config file missing fs.sftp.host while using relative URIs; environment-dependent URI resolution dropping the host.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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