{"record":{"id":"e02abebb24e09603","repo":"googleapis/mcp-toolbox","slug":"unable-to-connect-successfully-w-e02abe","errorCode":null,"errorMessage":"unable to connect successfully: %w","messagePattern":"unable to connect successfully: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/trino/trino.go","lineNumber":83,"sourceCode":"\tSSLCertPath            string `yaml:\"sslCertPath\"`\n\tSSLCert                string `yaml:\"sslCert\"`\n\tDisableSslVerification bool   `yaml:\"disableSslVerification\"`\n}\n\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tpool, err := initTrinoConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Catalog, r.Schema, r.QueryTimeout, r.AccessToken, r.KerberosEnabled, r.SSLEnabled, r.SSLCertPath, r.SSLCert, r.DisableSslVerification)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create pool: %w\", err)\n\t}\n\n\terr = pool.PingContext(ctx)\n\tif err != nil {\n\t\tpool.Close()\n\t\treturn nil, fmt.Errorf(\"unable to connect successfully: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig: r,\n\t\tPool:   pool,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {\n\tConfig\n\tPool *sql.DB\n}\n\nfunc (s *Source) IsReadOnly() bool {\n\treturn false","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/trino/trino.go#L65-L101","documentation":"After creating the Trino pool, Initialize calls PingContext to verify the server is actually reachable. If the ping fails, the pool is closed and this error wraps the driver error. It means configuration was parseable but the Trino coordinator did not accept the connection or handshake.","triggerScenarios":"pool.PingContext(ctx) returning an error during Trino source Initialize: DNS failure, connection refused, TLS handshake failure, invalid access token/kerberos credentials rejected by the coordinator, or context timeout.","commonSituations":"Wrong host/port (Trino default 8080 for HTTP, 8443 for HTTPS); SSL enabled but coordinator serves plain HTTP; expired/invalid access token; network/firewall blocking egress to the coordinator; Kerberos keytab/principal misconfiguration.","solutions":["Verify Trino coordinator host/port and that SSL setting matches the server (8080 http vs 8443 https)","Test reachability: curl https://<host>:<port>/v1/info with the same auth from the same network","Check access token validity or Kerberos credentials (keytab path, principal, realm)","Confirm TLS CA trust — add the coordinator CA via sslCertPath if self-signed","Check context deadline if the ping timed out"],"exampleFix":"// before\nport: \"8080\"\nsslEnabled: true\n// after\nport: \"8443\"\nsslEnabled: true","handlingStrategy":"validation","validationCode":"// probe the coordinator before Initialize\nu := fmt.Sprintf(\"http%s://%s:%s/v1/info\", sslMap(true:\"s\"), host, port)\nresp, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil)\n// expect 200; non-200 or dial error predicts ping failure","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil && strings.Contains(err.Error(), \"unable to connect successfully\") {\n    return fmt.Errorf(\"cannot reach Trino coordinator, check host/port/TLS/auth: %w\", err)\n}","preventionTips":["Match SSL flag to the coordinator port (8080=http, 8443=https)","Curl /v1/info from the deployment network as a preflight check","Provide the coordinator CA via sslCertPath for self-signed TLS","Verify token/Kerberos credentials before deployment and monitor expiry"],"tags":["database","trino","connectivity","ping","tls"],"backgroundTag":"connection-refused","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}