{"record":{"id":"8921454d20ea50d1","repo":"apache/seatunnel","slug":"failed-to-connect-to-host-host-by-user","errorCode":null,"errorMessage":"Failed to connect to host: \" + host + \" by user: \" + user + \" on port 22","messagePattern":"Failed to connect to host: \" \\+ host \\+ \" by user: \" \\+ user \\+ \" on port 22","errorType":"exception","errorClass":"ClickhouseConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/RsyncFileTransfer.java","lineNumber":86,"sourceCode":"            sshClient.start();\n            clientSession = sshClient.connect(user, host, SSH_PORT).verify().getSession();\n            if (password != null) {\n                clientSession.addPasswordIdentity(password);\n            }\n            if (keyPath != null) {\n                FileKeyPairProvider fileKeyPairProvider =\n                        new FileKeyPairProvider(Paths.get(keyPath));\n                KeyPair fileKeyPair =\n                        fileKeyPairProvider.loadKey(clientSession, KeyPairProvider.SSH_RSA);\n                clientSession.addPublicKeyIdentity(fileKeyPair);\n            }\n            if (!clientSession.auth().verify().isSuccess()) {\n                throw new ClickhouseConnectorException(\n                        ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,\n                        \"ssh host \" + host + \"authentication failed\");\n            }\n        } catch (IOException | GeneralSecurityException e) {\n            throw new ClickhouseConnectorException(\n                    ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,\n                    \"Failed to connect to host: \" + host + \" by user: \" + user + \" on port 22\",\n                    e);\n        }\n    }\n\n    @Override\n    public void transferAndChown(String sourcePath, String targetPath) {\n        try {\n            String sshParameter =\n                    password != null\n                            ? String.format(\n                                    \"'sshpass -p %s ssh -o StrictHostKeyChecking=no -p %s'\",\n                                    password, SSH_PORT)\n                            : keyPath != null\n                                    ? String.format(\n                                            \"'ssh -i %s -o StrictHostKeyChecking=no -p %s'\",\n                                            keyPath, SSH_PORT)","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/RsyncFileTransfer.java#L68-L104","documentation":"RsyncFileTransfer.init wraps IOException/GeneralSecurityException from establishing or authenticating the SSH session in an SSH_OPERATION_FAILED exception whose message is \"Failed to connect to host: <host> by user: <user> on port 22\", with the original exception as cause.","triggerScenarios":"init when the SSH connection to port 22 fails — host unreachable, wrong host/port, firewall blocking, SSH daemon down, DNS failure, or a GeneralSecurityException during crypto/key handling.","commonSituations":"ClickHouse node firewall blocks port 22 from the worker; sshd not running on the target; hostname typo or stale DNS; network partition between SeaTunnel worker and ClickHouse node.","solutions":["Check the chained cause for the exact network/IO error","Verify connectivity: `ssh <user>@<host>` or `nc -vz <host> 22` from the SeaTunnel worker machine","Confirm sshd is running on the ClickHouse node and the firewall allows port 22","Fix the hostname/IP and user in the sink configuration"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    transfer.init();\n} catch (ClickhouseConnectorException e) {\n    if (e.getMessage() != null && e.getMessage().contains(\"Failed to connect to host\")) {\n        // check network/sshd/firewall before retrying with backoff\n    }\n}","preventionTips":["Verify port 22 reachability from worker to each ClickHouse node before job submission","Run sshd on all shard nodes and allow it in firewall rules","Use stable hostnames/IPs with correct DNS"],"tags":["ssh","network","clickhouse"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}