googleapis/mcp-toolbox · error
unable to create pool: %w
Error message
unable to create pool: %w
What it means
Trino Config.Initialize wraps any failure from initTrinoConnectionPool. Pool creation involves building the Trino DSN, sql.Open, and setting driver-level connector options, so failures here mean the pool could not be constructed at all (not a connectivity issue yet — that is the following PingContext error). The underlying cause is preserved via %w.
Source
Thrown at internal/sources/trino/trino.go:77
Catalog string `yaml:"catalog" validate:"required"`
Schema string `yaml:"schema" validate:"required"`
QueryTimeout string `yaml:"queryTimeout"`
AccessToken string `yaml:"accessToken"`
KerberosEnabled bool `yaml:"kerberosEnabled"`
SSLEnabled bool `yaml:"sslEnabled"`
SSLCertPath string `yaml:"sslCertPath"`
SSLCert string `yaml:"sslCert"`
DisableSslVerification bool `yaml:"disableSslVerification"`
}
func (r Config) SourceConfigType() string {
return SourceType
}
func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
pool, 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)
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
- Inspect the wrapped cause for the exact failing step (DSN build vs sql.Open)
- Validate trino source config: host, port, user, catalog, schema, queryTimeout are well-formed
- If SSL is enabled, verify the certificate file exists and is PEM-encoded at sslCertPath
- Check for invalid auth combos (e.g. both accessToken and kerberos enabled)
Example fix
// before sslCertPath: "./certs/trino.crt" // file missing // after sslCertPath: "/etc/trino/tls/ca.pem" // verify: ls -l /etc/trino/tls/ca.pem
Defensive patterns
Strategy: validation
Validate before calling
func validateTrinoConfig(r trino.Config) error {
if r.Host == "" || r.Port == "" || r.User == "" { return errors.New("trino: host, port and user are required") }
if _, err := strconv.Atoi(r.Port); err != nil { return fmt.Errorf("trino: bad port %q", r.Port) }
if r.SSLEnabled && r.SSLCertPath != "" {
if _, err := os.ReadFile(r.SSLCertPath); err != nil { return fmt.Errorf("trino: cert unreadable: %w", err) }
}
if r.KerberosEnabled && r.AccessToken != "" { return errors.New("trino: kerberos and accessToken are mutually exclusive") }
return nil
} Try / catch
src, err := cfg.Initialize(ctx, tracer)
if err != nil && strings.Contains(err.Error(), "unable to create pool") {
return fmt.Errorf("trino source misconfigured: %w", err)
} Prevention
- Validate all trino config fields (host, port, catalog, schema) before calling Initialize
- Pre-check SSL cert files exist and are readable PEM
- Avoid enabling both kerberos and access token auth
- Keep queryTimeout a plain numeric string
When it happens
Trigger: Initialize on a Trino source where initTrinoConnectionPool returns an error: buildTrinoDSN failure, sql.Open failure, or errors configuring the connector (e.g. invalid SSL cert material).
Common situations: Invalid sslCertPath or inline sslCert content; malformed host/port values from config; unsupported combination of kerberosEnabled/accessToken/SSL flags passed to buildTrinoDSN.
Related errors
- unable to create pool: %w
- toolbox failed to initialize: %w
- unable to create pool: %w
- unable to create pool: %w
- unable to initialize source %q: %w
AI-assisted analysis of googleapis/mcp-toolbox@8cc6e09de2 (2026-09-05).
Data as JSON: /api/errors/8ffc5e007582509d.
Report an issue: GitHub.