{"record":{"id":"5b84d56c08991093","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-bigtable-newclient-w","errorCode":null,"errorMessage":"unable to create bigtable.NewClient: %w","messagePattern":"unable to create bigtable\\.NewClient: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigtable/bigtable.go","lineNumber":232,"sourceCode":"\treturn out, nil\n}\n\nfunc initBigtableClient(ctx context.Context, tracer trace.Tracer, name, project, instance string) (*bigtable.Client, error) {\n\t//nolint:all // Reassigned ctx\n\tctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)\n\tdefer span.End()\n\n\t// Set up Bigtable data operations client.\n\tpoolSize := 10\n\tuserAgent, err := util.UserAgentFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := bigtable.NewClient(ctx, project, instance, option.WithUserAgent(userAgent), option.WithGRPCConnectionPool(poolSize))\n\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create bigtable.NewClient: %w\", err)\n\t}\n\n\treturn client, nil\n}\n\nfunc initBigtableInstanceAdminClient(ctx context.Context, tracer trace.Tracer, name, project string) (*bigtable.InstanceAdminClient, error) {\n\t//nolint:all // Reassigned ctx\n\tctx, span := sources.InitConnectionSpan(ctx, tracer, SourceType, name)\n\tdefer span.End()\n\n\tuserAgent, err := util.UserAgentFromContext(ctx)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tclient, err := bigtable.NewInstanceAdminClient(ctx, project, option.WithUserAgent(userAgent))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create bigtable.NewInstanceAdminClient: %w\", err)","sourceCodeStart":214,"sourceCodeEnd":250,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigtable/bigtable.go#L214-L250","documentation":"bigtable.NewClient — the data (read/write) client constructor — returned an error while the Bigtable source was being initialized. The constructor dials the Bigtable data API endpoint, so failures are typically bad project/instance identifiers or credential problems, not yet data-plane permission issues (those surface at query time).","triggerScenarios":"Source Initialize() calls initBigtableClient, which calls bigtable.NewClient(ctx, project, instance, option.WithUserAgent(...), option.WithGRPCConnectionPool(10)); the constructor returns non-nil error.","commonSituations":"Wrong `project` or `instance` in toolbox config; no Application Default Credentials (GOOGLE_APPLICATION_CREDENTIALS unset, no gcloud auth, running outside GCP without a service account); metadata server unreachable in non-GCP environments.","solutions":["Set valid credentials: GOOGLE_APPLICATION_CREDENTIALS pointing to a service-account JSON, or `gcloud auth application-default login`","Verify `project` and `instance` in the source config match an existing Bigtable instance (`gcloud bigtable instances list`)","Check network access to bigtable.googleapis.com (proxy/firewall/VPC-SC)","Ensure ADC can be resolved in the runtime environment (GKE Workload Identity, metadata server, etc.)"],"exampleFix":"// before (env missing creds)\n// GOOGLE_APPLICATION_CREDENTIALS unset\n// after\nexport GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa-key.json","handlingStrategy":"validation","validationCode":"func preflightBigtableEnv(project, instance string) error {\n\tif os.Getenv(\"GOOGLE_APPLICATION_CREDENTIALS\") == \"\" {\n\t\tif _, err := exec.LookPath(\"gcloud\"); err == nil {\n\t\t\tout, err := exec.Command(\"gcloud\", \"auth\", \"application-default\", \"print-access-token\").Output()\n\t\t\tif err != nil || len(out) == 0 {\n\t\t\t\treturn fmt.Errorf(\"no Application Default Credentials available\")\n\t\t\t}\n\t\t}\n\t}\n\tif project == \"\" || instance == \"\" {\n\t\treturn fmt.Errorf(\"project and instance must be set in bigtable source config\")\n\t}\n\treturn nil\n}","typeGuard":null,"tryCatchPattern":"src, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n\tif strings.Contains(err.Error(), \"unable to create client\") || strings.Contains(err.Error(), \"bigtable.NewClient\") {\n\t\t// check credentials and project/instance IDs before retrying\n\t}\n\treturn err\n}","preventionTips":["Set GOOGLE_APPLICATION_CREDENTIALS or rely on Workload Identity in GCP","Run `gcloud auth application-default login` in local development","Verify project/instance IDs in config against `gcloud bigtable instances list`","Fail fast with a config preflight check at startup"],"tags":["gcp","bigtable","authentication","initialization"],"backgroundTag":"client-initialization-failed","analyzedSha":"8cc6e09de2ad7b8bffc77751799585a1401a48eb","analyzedAt":"2026-09-05T01:10:36.887Z","contentChangedAt":"2026-09-05T01:10:36.887Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}