googleapis/mcp-toolbox · error

unable to create client: %w

Error message

unable to create client: %w

What it means

spanner.NewClient failed during source Initialize — the Spanner client could not be created for the configured project/instance/database, usually due to missing credentials, disabled API, or an invalid database path.

Source

Thrown at internal/sources/spanner/spanner.go:69

type Config struct {
	Name           string          `yaml:"name" validate:"required"`
	Type           string          `yaml:"type" validate:"required"`
	Project        string          `yaml:"project" validate:"required"`
	Instance       string          `yaml:"instance" validate:"required"`
	Dialect        sources.Dialect `yaml:"dialect" validate:"required"`
	Database       string          `yaml:"database" validate:"required"`
	UseClientOAuth bool            `yaml:"useClientOAuth"`
}

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

func (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {
	client, err := initSpannerClient(ctx, tracer, r.Name, r.Project, r.Instance, r.Database)
	if err != nil {
		return nil, fmt.Errorf("unable to create client: %w", err)
	}

	onDataplexEvict := func(key string, value interface{}) {
		if client, ok := value.(*dataplexapi.CatalogClient); ok && client != nil {
			client.Close()
		}
	}

	s := &Source{
		Config: r,
		Client: client,
		dataplexMgr: &searchcatalog.DataplexClientManager{
			UseClientOAuth: r.UseClientOAuth,
			Cache:          sources.NewCache(onDataplexEvict),
		},
	}
	return s, nil
}

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Verify ADC credentials and spanner API enablement
  2. Confirm project, instance and database names are correct
  3. Check network access to Spanner endpoints
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at internal/sources/spanner/spanner.go:69 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/deb0616e4970989f. Report an issue: GitHub.