googleapis/mcp-toolbox · error
unable to connect successfully: %w
Error message
unable to connect successfully: %w
What it means
After successfully creating the pool, Initialize calls PingContext to verify a real connection can be established; failure means the pool exists but MindsDB rejected or timed out the connection. The pool is closed and initialization fails. This is distinct from pool-creation failure: auth or network problems happen at ping time.
Source
Thrown at internal/sources/mindsdb/mindsdb.go:73
Password string `yaml:"password"`
Database string `yaml:"database" validate:"required"`
QueryTimeout string `yaml:"queryTimeout"`
}
func (r Config) SourceConfigType() string {
return SourceType
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
pool, err := initMindsDBConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database, r.QueryTimeout)
if err != nil {
return nil, fmt.Errorf("unable to create pool: %w", err)
}
err = pool.PingContext(ctx)
if err != nil {
pool.Close()
return nil, fmt.Errorf("unable to connect successfully: %w", err)
}
s := &Source{
Config: r,
Pool: pool,
}
return s, nil
}
var _ sources.Source = &Source{}
type Source struct {
Config
Pool *sql.DB
}
func (s *Source) IsReadOnly() bool {
return falseView on GitHub (pinned to 8cc6e09de2)
Solutions
- Verify user/password with a direct MySQL client against the MindsDB server
- Confirm the configured database exists in MindsDB (SHOW DATABASES)
- Increase the query timeout / extend the context deadline if pings time out under load
- Ensure MindsDB is fully started and reachable before launching the toolbox
Example fix
// before database: myproj # not created yet // after # run in MindsDB: CREATE DATABASE myproj; database: myproj
Defensive patterns
Strategy: retry
Validate before calling
db, err := sql.Open("mysql", dsn)
if err != nil { return err }
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
if err := db.PingContext(ctx); err != nil {
return fmt.Errorf("cannot reach mindsdb with given credentials: %w", err)
} Try / catch
err = pool.PingContext(ctx)
if err != nil {
if mysqlErr, ok := err.(*mysql.MySQLError); ok && mysqlErr.Number == 1045 {
// access denied: fix user/password
}
// retry with backoff for transient failures
} Prevention
- Create the database/project in MindsDB before wiring the config
- Add a readiness check (ping) with backoff at startup for containerized MindsDB
- Validate credentials with a mysql CLI one-liner before deploying
When it happens
Trigger: pool.PingContext(ctx) fails because credentials are wrong, the database name is unknown, the server is down/overloaded, or the context deadline (query timeout) expires before the handshake completes.
Common situations: Incorrect MindsDB user/password; database/project name not yet created in MindsDB; MindsDB container not ready at startup; firewall dropping the MySQL-protocol port.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- unable to create pool: %w
- unable to connect successfully: %w
- unable to connect successfully: %w
- unable to execute query: %w
- unable to retrieve rows column name: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/ee322aae5e9a4fdf.
Report an issue: GitHub.