googleapis/mcp-toolbox · error

unable to create pool: %w

Error message

unable to create pool: %w

What it means

MindsDB Config.Initialize builds a MySQL-compatible connection pool via initMindsDBConnectionPool; if pool construction fails (bad DSN parameters, unreachable host, driver error), the error is wrapped as "unable to create pool". Initialization aborts before any ping is attempted.

Source

Thrown at internal/sources/mindsdb/mindsdb.go:67

type Config struct {
	Name         string `yaml:"name" validate:"required"`
	Type         string `yaml:"type" validate:"required"`
	Host         string `yaml:"host" validate:"required"`
	Port         string `yaml:"port" validate:"required"`
	User         string `yaml:"user" validate:"required"`
	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 {

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Verify the MindsDB host and port (default 47335 for MySQL protocol) are correct and reachable
  2. Test connectivity: `nc -zv <host> <port>` or `mysql -h <host> -P <port> -u <user> -p`
  3. Escape or sanitize special characters in user/password so the DSN is valid
  4. Check that the MindsDB server is running and accepting connections

Example fix

// before
host: mindb.internal
port: 3306
// after
host: mindsdb.example.com
port: 47335
Defensive patterns

Strategy: validation

Validate before calling

conn, err := net.DialTimeout("tcp", net.JoinHostPort(host, port), 3*time.Second)
if err != nil {
    return fmt.Errorf("mindsdb unreachable at %s:%s: %w", host, port, err)
}
conn.Close()

Try / catch

if err != nil {
    var ne net.Error
    if errors.As(err, &ne) && ne.Timeout() {
        // host/port or firewall issue
    }
    return fmt.Errorf("pool init failed: %w", err)
}

Prevention

When it happens

Trigger: Initialize called with a host/port that fails to resolve or connect, invalid user/password format producing a bad DSN, or invalid query timeout such that the go-sql-driver/mysql mysql.New() (or equivalent) fails.

Common situations: Wrong MindsDB host or port (default 47335); typo in hostname; DNS failure in containers; unsupported characters in credentials breaking DSN formatting.

Related errors


AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05). Data as JSON: /api/errors/d2270e61fa824b05. Report an issue: GitHub.