googleapis/mcp-toolbox · error

unable to create pool: %w

Error message

unable to create pool: %w

What it means

Error "unable to create pool: %w" thrown in googleapis/mcp-toolbox.

Source

Thrown at internal/sources/postgres/postgres.go:77

	Password      string            `yaml:"password" validate:"required"`
	Database      string            `yaml:"database" validate:"required"`
	QueryParams   map[string]string `yaml:"queryParams"`
	QueryExecMode string            `yaml:"queryExecMode" validate:"omitempty,oneof=cache_statement cache_describe describe_exec exec simple_protocol"`
	SQLCommenter  *bool             `yaml:"sqlCommenter"`
	// ConnectTimeout optionally bounds how long a single connection attempt may
	// take, in seconds. When unset, no timeout is applied and connection behavior
	// is unchanged.
	ConnectTimeout *int `yaml:"connectTimeout" validate:"omitempty,gte=1"`
}

func (r Config) SourceConfigType() string {
	return SourceType
}

func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
	pool, err := initPostgresConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database, r.QueryParams, r.QueryExecMode, r.ConnectTimeout)
	if err != nil {
		return nil, fmt.Errorf("unable to create pool: %w", err)
	}

	err = pool.Ping(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)

When it happens

Trigger: Thrown at internal/sources/postgres/postgres.go:77 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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