OtterMind/Chat2DB · error · ConnectionException
connection.ssh.error
connection.ssh.error
Error message
connection.ssh.error
What it means
ConnectionException thrown by testSshConnection() when SSHManager.getSSHSession(ssh) raises any Exception (wrapped with the cause). It signals the SSH tunnel could not be established with the provided SSHInfo.
Source
Thrown at chat2db-community-server/chat2db-community-domain/chat2db-community-domain-core/src/main/java/ai/chat2db/community/domain/core/impl/db/DbDataSourceServiceImpl.java:102
}
@Override
public DriverConfig defaultDriverConfig(String dbType) {
return Chat2DBContext.getDefaultDriverConfig(dbType);
}
@Override
public void removeConnection(Long id) {
ConnectionPool.removeConnection(id);
}
@Override
public void testSshConnection(SSHInfo ssh) {
Session session = null;
try {
session = SSHManager.getSSHSession(ssh);
} catch (Exception e) {
throw new ConnectionException("connection.ssh.error", null, e);
} finally {
if (session != null) {
session.disconnect();
}
}
}
@Override
public void closeRuntime() {
Chat2DBContext.close();
SSHManager.close();
}
private void validate(DbDataSourcePreConnectRequest param) {
if (!ConfigUtils.isDesktop() && ConfigUtils.isRelease()) {
if ("LocalFile".equalsIgnoreCase(param.getServiceType())
&& ("H2".equalsIgnoreCase(param.getType()) || "SQLite".equalsIgnoreCase(param.getType()))) {
throw new BusinessException("web.not.support.db.type");View on GitHub (pinned to 5ee1e990e7)
Solutions
- Inspect the chained cause for the SSH-layer error (auth failed, connection refused, timeout).
- Verify SSH host, port, username, and that the private key path is readable and has correct permissions (chmod 600).
- Confirm network reachability and firewall rules to the bastion before re-testing.
Defensive patterns
Strategy: try-catch
Validate before calling
// Pre-flight SSH field check
if (StringUtils.isAnyBlank(ssh.getHost(), ssh.getPort() == null ? null : String.valueOf(ssh.getPort()), ssh.getUserName())) {
return Result.fail("connection.ssh.error");
} Try / catch
try {
dataSourceService.testSshConnection(ssh);
} catch (ConnectionException e) {
// e.getCause() holds the SSH-layer error (auth/refused/timeout)
// prompt the user to fix host/port/user/key
} Prevention
- Validate SSH host/port/user and key path before testing.
- Ensure the private key file is readable with restrictive permissions (chmod 600).
- Confirm bastion firewall rules allow the source IP.
When it happens
Trigger: testSshConnection(ssh) is called with an SSH host that is unreachable, wrong port, invalid credentials (password/key), key file unreadable, or the SSH server rejects authentication.
Common situations: Misconfigured SSH host/port, wrong username, expired/incorrect private key, key file permission issues on Linux, or the bastion host blocking the source IP.
Related errors
- dataSourceConnect.getMessage()
- datasource_connection_failed
- connection error
- connection error
- datasource.not.found
AI-assisted analysis of OtterMind/Chat2DB@5ee1e990e7 (2026-08-14).
Data as JSON: /api/errors/61ace7ce0303ffaa.
Report an issue: GitHub.