googleapis/mcp-toolbox · error
unable to create pool: %w
Error message
unable to create pool: %w
What it means
clickhouse.Config.Initialize wraps any failure from initClickHouseConnectionPool (building the sqlx/database-sql connection pool) with this message. It means the pool object itself could not be created, typically due to invalid DSN or driver issues.
Source
Thrown at internal/sources/clickhouse/clickhouse.go:69
Name string `yaml:"name" validate:"required"`
Type string `yaml:"type" validate:"required"`
Host string `yaml:"host" validate:"required"`
Port string `yaml:"port" validate:"required"`
Database string `yaml:"database" validate:"required"`
User string `yaml:"user" validate:"required"`
Password string `yaml:"password"`
Protocol string `yaml:"protocol"`
Secure bool `yaml:"secure"`
}
func (r Config) SourceConfigType() string {
return SourceType
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
pool, err := initClickHouseConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database, r.Protocol, r.Secure)
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
- Verify host, port, protocol values are valid and correctly formatted.
- Check special characters in user/password are URL-escaped in the DSN.
- Confirm the ClickHouse server accepts connections on the configured port (8123 http / 9000 native).
- Read the wrapped error (%w) for the driver's root cause.
Example fix
// before
r := clickhouse.Config{Host: "ch host", Port: "notaport"}
// after
r := clickhouse.Config{Host: "127.0.0.1", Port: "8123", Protocol: "http"} Defensive patterns
Strategy: validation
Validate before calling
if r.Host == "" || r.Port == "" { return errors.New("clickhouse host/port required") }
if _, err := strconv.Atoi(r.Port); err != nil { return fmt.Errorf("invalid port: %w", err) } Try / catch
src, err := cfg.Initialize(ctx, tracer)
if err != nil {
if strings.Contains(err.Error(), "unable to create pool") { return err } // config-level, no retry
return err
} Prevention
- Validate host/port/protocol values before Initialize.
- URL-escape credentials in generated DSNs.
- Test pool creation in CI against a local ClickHouse.
When it happens
Trigger: Calling Initialize on a clickhouse Config when the driver cannot construct a pool from host/port/user/password/database/protocol/secure parameters.
Common situations: Invalid host or port format, unsupported protocol (http/native), bad DSN characters in credentials, missing driver registration.
Related errors
- unable to create pool: %w
- unable to create pool: %w
- failed to initialize resources: %w
- toolbox failed to initialize: %w
- failed to initialize resources: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/4d7825d0c474ccbd.
Report an issue: GitHub.