{"record":{"id":"7fccf379903bf390","repo":"googleapis/mcp-toolbox","slug":"unable-to-connect-successfully-w-7fccf3","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/singlestore/singlestore.go","lineNumber":79,"sourceCode":"\tConnectionParams map[string]string `yaml:\"connectionParams\"`\n}\n\n// SourceConfigType returns the type of the source configuration.\nfunc (r Config) SourceConfigType() string {\n\treturn SourceType\n}\n\n// Initialize sets up the SingleStore connection pool and returns a Source.\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tpool, err := initSingleStoreConnectionPool(ctx, tracer, r)\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\n// Source represents a SingleStore database source and holds its connection pool.\ntype Source struct {\n\tConfig\n\tPool *sql.DB\n}\n\n// SourceType returns the type of the source configuration.","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/singlestore/singlestore.go#L61-L97","documentation":"This error is wrapped by SingleStore's Config.Initialize when pool.PingContext(ctx) fails after the connection pool was created. It means a pool object was constructed from the DSN, but the first real network round-trip to the SingleStore server failed, so the source cannot be considered usable. The pool is closed before returning the error, so the failure is terminal for initialization.","triggerScenarios":"Initialize() calls initSingleStoreConnectionPool successfully (sql.Open is lazy), then PingContext(ctx) returns an error: server unreachable, bad credentials, unknown database, TLS negotiation failure, or context cancellation during the ping.","commonSituations":"Wrong host/port in the SingleStore config, firewall or VPC network blocking port 3306/3307, invalid user/password, database name that does not exist, SingleStore cluster paused or not yet provisioned, or TLS settings (tls=preferred/true) incompatible with the server.","solutions":["Verify the SingleStore endpoint (host, port) is reachable: run `nc -vz <host> <port>` or connect with the `mysql` CLI using the same credentials.","Check user, password, and database values in the toolbox config against the SingleStore portal / `SHOW DATABASES`.","Review connectionParams and tls settings; try `tls: \"preferred\"` vs `skip-verify` if certificates are self-signed.","Check that the SingleStore cluster is running and not suspended; restart it if paused.","Increase or fix queryTimeout-derived readTimeout if long pings time out on slow networks."],"exampleFix":"// before (unreachable host)\nkind: source\nname: my_ss\nhost: internal-wrong-host\nport: 3306\n// after (correct endpoint)\nkind: source\nname: my_ss\nhost: my-cluster.svc.singlestore.com\nport: 3306","handlingStrategy":"validation","validationCode":"// Pre-check reachability before Initialize\ntimeout, cancel := context.WithTimeout(ctx, 5*time.Second)\ndefer cancel()\nconn, err := net.DialTimeout(\"tcp\", net.JoinHostPort(cfg.Host, cfg.Port), 4*time.Second)\nif err != nil { return fmt.Errorf(\"singlestore unreachable at %s:%s: %w\", cfg.Host, cfg.Port, err) }\nconn.Close()\n_ = timeout","typeGuard":null,"tryCatchPattern":"// Initialize returns (source, error); inspect the wrapped cause\nsrc, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n    var nerr net.Error\n    if errors.As(err, &nerr) && nerr.Timeout() {\n        // network/firewall/timeout path\n    }\n    if strings.Contains(err.Error(), \"Access denied\") {\n        // credentials path\n    }\n    return fmt.Errorf(\"init failed: %w\", err)\n}","preventionTips":["Validate host/port/credentials with the mysql CLI before registering the source","Keep the SingleStore cluster running and monitor it","Prefer explicit TLS settings verified against your server certificate","Set realistic queryTimeout values"],"tags":["singlestore","database","connection","network"],"backgroundTag":"database-connection-failure","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"}