googleapis/mcp-toolbox · error

unable to create bigtable.NewInstanceAdminClient: %w

Error message

unable to create bigtable.NewInstanceAdminClient: %w

What it means

bigtable.NewInstanceAdminClient failed during source initialization. This admin client manages instance-level operations against the Bigtable admin endpoint for the given project. Failure typically means invalid project ID, missing/invalid credentials, or no network path to the admin API.

Source

Thrown at internal/sources/bigtable/bigtable.go:250

		return nil, fmt.Errorf("unable to create bigtable.NewClient: %w", err)
	}

	return client, nil
}

func initBigtableInstanceAdminClient(ctx context.Context, tracer trace.Tracer, name, project string) (*bigtable.InstanceAdminClient, error) {
	//nolint:all // Reassigned ctx
	ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)
	defer span.End()

	userAgent, err := util.UserAgentFromContext(ctx)
	if err != nil {
		return nil, err
	}

	client, err := bigtable.NewInstanceAdminClient(ctx, project, option.WithUserAgent(userAgent))
	if err != nil {
		return nil, fmt.Errorf("unable to create bigtable.NewInstanceAdminClient: %w", err)
	}

	return client, nil
}

func initBigtableAdminClient(ctx context.Context, tracer trace.Tracer, name, project, instance string) (*bigtable.AdminClient, error) {
	//nolint:all // Reassigned ctx
	ctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)
	defer span.End()

	userAgent, err := util.UserAgentFromContext(ctx)
	if err != nil {
		return nil, err
	}

	client, err := bigtable.NewAdminClient(ctx, project, instance, option.WithUserAgent(userAgent))
	if err != nil {
		return nil, fmt.Errorf("unable to create bigtable.NewAdminClient: %w", err)

View on GitHub (pinned to 8cc6e09de2)

Solutions

  1. Verify the `project` field is a valid GCP project ID containing the Bigtable instance
  2. Configure Application Default Credentials (GOOGLE_APPLICATION_CREDENTIALS or gcloud auth application-default login)
  3. Check network access to bigtableadmin.googleapis.com
  4. Confirm the service account has Bigtable admin permissions on the project

Example fix

// before
project: my-projec   # typo
// after
project: my-project
Defensive patterns

Strategy: validation

Validate before calling

func preflightAdminAccess(ctx context.Context, project string) error {
	if project == "" {
		return fmt.Errorf("bigtable source requires a project")
	}
	creds, err := google.FindDefaultCredentials(ctx, "https://www.googleapis.com/auth/cloud-bigtable.admin")
	if err != nil {
		return fmt.Errorf("no valid credentials for bigtable admin API: %w", err)
	}
	_ = creds
	return nil
}

Try / catch

src, err := cfg.Initialize(ctx, tracer)
if err != nil {
	if strings.Contains(err.Error(), "NewInstanceAdminClient") {
		// project ID or credentials/network problem for the admin endpoint
	}
	return err
}

Prevention

When it happens

Trigger: Source Initialize() calls initBigtableInstanceAdminClient, which calls bigtable.NewInstanceAdminClient(ctx, project, option.WithUserAgent(userAgent)); the constructor returns non-nil error.

Common situations: Typo in `project`; no ADC credentials in the environment; firewall/proxy blocking bigtableadmin.googleapis.com; running locally without gcloud auth configured.

Related errors


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