googleapis/mcp-toolbox · error
failed to open connection: %w
Error message
failed to open connection: %w
What it means
sqlx.Open (via the Trino driver) failed in initTrinoConnectionPool — the DSN built from host/port/user/credentials/catalog/schema was rejected or the Trino coordinator was unreachable.
Source
Thrown at internal/sources/trino/trino.go:197
return nil, fmt.Errorf("unable to get logger from ctx: %s", err)
}
if disableSslVerification {
logger.WarnContext(ctx, "SSL verification is disabled for trino source %s. This is an insecure setting and should not be used in production.\n", name)
tr := &http.Transport{
TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
}
client := &http.Client{Transport: tr}
clientName := fmt.Sprintf("insecure_trino_client_%s", name)
if err := trinogo.RegisterCustomClient(clientName, client); err != nil {
return nil, fmt.Errorf("failed to register custom client: %w", err)
}
dsn = fmt.Sprintf("%s&custom_client=%s", dsn, clientName)
}
db, err := sql.Open("trino", dsn)
if err != nil {
return nil, fmt.Errorf("failed to open connection: %w", err)
}
// Configure connection pool
db.SetMaxOpenConns(10)
db.SetMaxIdleConns(5)
db.SetConnMaxLifetime(time.Hour)
return db, nil
}
func buildTrinoDSN(host, port, user, password, catalog, schema, queryTimeout, accessToken string, kerberosEnabled, sslEnabled bool, sslCertPath, sslCert string) (string, error) {
// Build query parameters
query := url.Values{}
query.Set("catalog", catalog)
query.Set("schema", schema)
if queryTimeout != "" {
query.Set("queryTimeout", queryTimeout)
}View on GitHub (pinned to 8cc6e09de2)
Solutions
- Verify host, port, credentials, catalog and schema in the config
- Confirm Trino coordinator reachability and TLS settings
- Check Kerberos/access-token configuration if enabled
Defensive patterns
Strategy: retry
When it happens
Trigger: Thrown at internal/sources/trino/trino.go:197 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/31b2cd121f847343.
Report an issue: GitHub.