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
- Include the host in the URI: sftp://myhost/path/to/file
- Or set conf.set("fs.sftp.host", "myhost") before initializing the filesystem
- 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
- Always build SFTP URIs with an explicit authority (sftp://host/path)
- Set fs.sftp.host as a fallback default in job config
- Validate URIs in config parsing before job submission
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
- No user specified for sftp connection. Expand URI or credent
- Schema config can not be empty
- Can not find catalog table with factoryId [%s]
- Schema config need option [schema], please correct your conf
- Schema config can't contains both [fields] and [columns], pl
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/b6125d7aa2f7985f.
Report an issue: GitHub.