{"record":{"id":"530fb7a7ad4400f9","repo":"apache/seatunnel","slug":"no-user-specified-for-sftp-connection-expand-uri","errorCode":null,"errorMessage":"No user specified for sftp connection. Expand URI or credential file.","messagePattern":"No user specified for sftp connection\\. Expand URI or credential file\\.","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java","lineNumber":118,"sourceCode":"        int port = uriInfo.getPort();\n        port = (port == -1) ? conf.getInt(FS_SFTP_HOST_PORT, DEFAULT_SFTP_PORT) : port;\n        conf.setInt(FS_SFTP_HOST_PORT, port);\n\n        // get user/password information from URI\n        String userAndPwdFromUri = uriInfo.getUserInfo();\n        if (userAndPwdFromUri != null) {\n            String[] userPasswdInfo = userAndPwdFromUri.split(\":\");\n            String user = userPasswdInfo[0];\n            user = URLDecoder.decode(user, \"UTF-8\");\n            conf.set(FS_SFTP_USER_PREFIX + host, user);\n            if (userPasswdInfo.length > 1) {\n                conf.set(FS_SFTP_PASSWORD_PREFIX + host + \".\" + user, userPasswdInfo[1]);\n            }\n        }\n\n        String user = conf.get(FS_SFTP_USER_PREFIX + host);\n        if (user == null || user.equals(\"\")) {\n            throw new IllegalStateException(E_USER_NULL);\n        }\n\n        int connectionMax = conf.getInt(FS_SFTP_CONNECTION_MAX, DEFAULT_MAX_CONNECTION);\n        connectionPool = new SFTPConnectionPool(connectionMax, 0);\n    }\n\n    private ChannelSftp connect() throws IOException {\n        Configuration conf = getConf();\n\n        String host = conf.get(FS_SFTP_HOST, null);\n        int port = conf.getInt(FS_SFTP_HOST_PORT, DEFAULT_SFTP_PORT);\n        String user = conf.get(FS_SFTP_USER_PREFIX + host, null);\n        String pwd = conf.get(FS_SFTP_PASSWORD_PREFIX + host + \".\" + user, null);\n        String keyFile = conf.get(FS_SFTP_KEYFILE, null);\n\n        ChannelSftp channel = connectionPool.connect(host, port, user, pwd, keyFile);\n\n        return channel;","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-file/connector-file-sftp/src/main/java/org/apache/seatunnel/connectors/seatunnel/file/sftp/system/SFTPFileSystem.java#L100-L136","documentation":"setConfigurationFromURI resolves the SFTP username from the URI user info or credential properties (fs.sftp.user.<host>); if none is found it throws IllegalStateException with E_USER_NULL: \"No user specified for sftp connection. Expand URI or credential file.\" Authentication is impossible without a user, so setup aborts.","triggerScenarios":"URI has no user-info (sftp://host/path) and no fs.sftp.user.<host> (or credential file providing user/password pairs) is configured for the resolved host.","commonSituations":"Moving jobs between environments where the credential file isn't present; host name mismatch so the FS_SFTP_USER_PREFIX + host key doesn't match the configured key (e.g. IP vs hostname); forgot to set user-info in the URI.","solutions":["Add user info to the URI: sftp://user@host/path","Or set the per-host property: conf.set(\"fs.sftp.user.<host>\", \"user\") (with fs.sftp.password.<host> as needed)","Provide the credential file that setConfigurationFromURI parses (user:password entries) and ensure its host entry matches the resolved host exactly","Make sure the same host string (hostname vs IP) is used in both URI and config keys"],"exampleFix":"// before\nURI uri = URI.create(\"sftp://sftp.example.com/data\"); // no user\n// after\nURI uri = URI.create(\"sftp://deploy@sftp.example.com/data\");\nconf.set(\"fs.sftp.password.sftp.example.com\", \"secret\");","handlingStrategy":"validation","validationCode":"String host = uri.getHost();\nif (uri.getUserInfo() == null && conf.get(\"fs.sftp.user.\" + host) == null)\n    throw new IllegalArgumentException(\"SFTP user missing: set user-info or fs.sftp.user.\" + host);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include user in URIs (sftp://user@host/path) or always set fs.sftp.user.<host>","Ensure credential files ship with the job and host keys match exactly (hostname vs IP)","Smoke-test SFTP auth per environment before running jobs"],"tags":["sftp","config","missing-credentials"],"backgroundTag":"missing-credentials","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}