{"record":{"id":"5d76ee3b05f0c2a9","repo":"googleapis/mcp-toolbox","slug":"unable-to-create-admin-client-w","errorCode":null,"errorMessage":"unable to create admin client: %w","messagePattern":"unable to create admin client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigtable/bigtable.go","lineNumber":76,"sourceCode":"}\n\nfunc (r Config) Initialize(ctx context.Context, tracer trace.Tracer) (sources.Source, error) {\n\tclient, err := initBigtableClient(ctx, tracer, r.Name, r.Project, r.Instance)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"unable to create client: %w\", err)\n\t}\n\n\tinstanceAdminClient, err := initBigtableInstanceAdminClient(ctx, tracer, r.Name, r.Project)\n\tif err != nil {\n\t\tclient.Close()\n\t\treturn nil, fmt.Errorf(\"unable to create instance admin client: %w\", err)\n\t}\n\n\tadminClient, err := initBigtableAdminClient(ctx, tracer, r.Name, r.Project, r.Instance)\n\tif err != nil {\n\t\tclient.Close()\n\t\tinstanceAdminClient.Close()\n\t\treturn nil, fmt.Errorf(\"unable to create admin client: %w\", err)\n\t}\n\n\ts := &Source{\n\t\tConfig:        r,\n\t\tClient:        client,\n\t\tInstanceAdmin: instanceAdminClient,\n\t\tAdmin:         adminClient,\n\t}\n\treturn s, nil\n}\n\nvar _ sources.Source = &Source{}\n\ntype Source struct {\n\tConfig\n\tClient        *bigtable.Client\n\tInstanceAdmin *bigtable.InstanceAdminClient\n\tAdmin         *bigtable.AdminClient","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigtable/bigtable.go#L58-L94","documentation":"This error is wrapped during Bigtable source initialization after the data client and instance admin client were already created successfully. It means bigtable.NewAdminClient (used for table/schema admin operations) failed to construct. Since the two prior clients succeeded, this usually points at instance-level problems (bad instance ID) or intermittent credential/API failures.","triggerScenarios":"Source Initialize() calls initBigtableAdminClient, which invokes bigtable.NewAdminClient(ctx, project, instance, option.WithUserAgent(userAgent)); the constructor returns a non-nil error.","commonSituations":"Wrong `instance` value in the toolbox config (data and instance-admin clients succeeded because they tolerate/validate differently, but the admin client rejects the instance ID); the instance was deleted or renamed; transient gRPC/network failure; partially-scoped credentials failing admin endpoint checks.","solutions":["Verify the `instance` field in the bigtable source config matches an existing Bigtable instance ID (`gcloud bigtable instances list --project=<project>`)","Verify the `project` ID is correct and Application Default Credentials are valid (`gcloud auth application-default login`)","Check network connectivity / VPC-SC / proxy settings that could block the Bigtable admin API endpoint","Retry initialization — gRPC dial failures can be transient"],"exampleFix":"// before\nsources:\n  my-bt:\n    type: bigtable\n    project: my-project\n    instance: prod-instnace   # typo\n// after\nsources:\n  my-bt:\n    type: bigtable\n    project: my-project\n    instance: prod-instance","handlingStrategy":"validation","validationCode":"func validateBigtableInstance(ctx context.Context, project, instance string) error {\n\tif project == \"\" || instance == \"\" {\n\t\treturn fmt.Errorf(\"project and instance are required\")\n\t}\n\t// verify instance exists before building the source\n\tc, err := gax.NewHTTPClient()\n\t_ = c\n\tout, err := exec.Command(\"gcloud\", \"bigtable\", \"instances\", \"describe\", instance, \"--project\", project).CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"instance %q not found in project %q: %v: %s\", instance, project, err, out)\n\t}\n\treturn nil\n}","typeGuard":"if adminClient, ok := err.(*googleapi.Error); ok && adminClient.Code == 404 { /* instance missing */ }","tryCatchPattern":"s, err := cfg.Initialize(ctx, tracer)\nif err != nil {\n\tvar gerr *googleapi.Error\n\tif errors.As(err, &gerr) {\n\t\tlog.Printf(\"bigtable admin init failed: code=%d msg=%s\", gerr.Code, gerr.Message)\n\t}\n\treturn err\n}","preventionTips":["Validate project/instance IDs against the live project before deploying the config","Use one canonical source of truth for instance IDs across environments","Grant the runtime service account Bigtable Admin to rule out permission variance","Retry transient initialization failures with backoff"],"tags":["gcp","bigtable","initialization","configuration"],"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"}