googleapis/mcp-toolbox · error

unable to connect successfully: %w

Error message

unable to connect successfully: %w

What it means

PingContext failed on the newly created TiDB pool during Initialize; the pool handle opened but the verification round-trip failed, so the pool is closed and the source is rejected.

Source

Thrown at internal/sources/tidb/tidb.go:80

	Password string `yaml:"password" validate:"required"`
	Database string `yaml:"database" validate:"required"`
	UseSSL   bool   `yaml:"ssl"`
}

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

func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
	pool, err := initTiDBConnectionPool(ctx, tracer, r.Name, r.Host, r.Port, r.User, r.Password, r.Database, r.UseSSL)
	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 false

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Verify credentials and database name
  2. Check TiDB server status and network latency/limits
  3. Ensure TLS settings match (ssl: true/false)
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/sources/tidb/tidb.go:80 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/ef19c5c5fa6a0065. Report an issue: GitHub.