{"record":{"id":"3bc397611c7cc227","repo":"googleapis/mcp-toolbox","slug":"failed-to-list-instances-w","errorCode":null,"errorMessage":"failed to list instances: %w","messagePattern":"failed to list instances: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/sources/bigtable/admin_wrappers.go","lineNumber":76,"sourceCode":"\treturn map[string]string{\"status\": \"instance updated successfully\"}, nil\n}\n\nfunc (s *Source) DeleteInstance(ctx context.Context, instanceId string) (any, error) {\n\terr := s.InstanceAdmin.DeleteInstance(ctx, instanceId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to delete instance: %w\", err)\n\t}\n\treturn map[string]string{\"status\": \"instance deleted successfully\"}, nil\n}\n\nfunc (s *Source) ListInstances(ctx context.Context) (any, error) {\n\tinstances, err := s.InstanceAdmin.Instances(ctx)\n\tif err != nil {\n\t\tvar partialErr bigtable.ErrPartiallyUnavailable\n\t\tif errors.As(err, &partialErr) {\n\t\t\treturn instances, nil\n\t\t}\n\t\treturn nil, fmt.Errorf(\"failed to list instances: %w\", err)\n\t}\n\treturn instances, nil\n}\n\nfunc (s *Source) GetCluster(ctx context.Context, instanceId, clusterId string) (any, error) {\n\tcluster, err := s.InstanceAdmin.GetCluster(ctx, instanceId, clusterId)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"failed to get cluster: %w\", err)\n\t}\n\treturn cluster, nil\n}\n\nfunc (s *Source) ListClusters(ctx context.Context, instanceId string) (any, error) {\n\tclusters, err := s.InstanceAdmin.Clusters(ctx, instanceId)\n\tif err != nil {\n\t\tvar partialErr bigtable.ErrPartiallyUnavailable\n\t\tif errors.As(err, &partialErr) {\n\t\t\treturn clusters, nil","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/googleapis/mcp-toolbox/blob/8cc6e09de2ad7b8bffc77751799585a1401a48eb/internal/sources/bigtable/admin_wrappers.go#L58-L94","documentation":"Raised by ListInstances when s.InstanceAdmin.Instances fails against the Bigtable Admin API. Notably, if the error wraps bigtable.ErrPartiallyUnavailable (some instances in a cluster are temporarily unavailable), the source treats it as non-fatal and returns the partial list instead of this error. This error therefore indicates a total listing failure: auth, network, or project-level problems.","triggerScenarios":"Calling ListInstances(ctx) when the credentials lack bigtable.instances.list permission, the project ID is wrong or unset, quota/network issues break the admin RPC, or the API returns a non-partial failure not classified as ErrPartiallyUnavailable.","commonSituations":"Misconfigured Application Default Credentials (no GOOGLE_APPLICATION_CREDENTIALS or wrong service account); pointing at a project that doesn't exist or differs from where instances live; transient Google API outages beyond partial unavailability.","solutions":["Check credentials: run `gcloud auth application-default login` or fix GOOGLE_APPLICATION_CREDENTIALS and confirm the service account has roles/bigtable.viewer or admin.","Verify the project ID passed to the Bigtable admin client matches the project containing the instances.","Retry with backoff on transient codes (Unavailable, Internal); check Google Cloud status dashboards for ongoing incidents.","Unwrap with errors.As to log the underlying gRPC status code for precise diagnosis."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// before calling ListInstances\nif os.Getenv(\"GOOGLE_APPLICATION_CREDENTIALS\") == \"\" && os.Getenv(\"BIGTABLE_PROJECT_ID\") == \"\" {\n    return errors.New(\"bigtable credentials/project not configured\")\n}","typeGuard":"func isPartialUnavailable(err error) bool {\n    var pe bigtable.ErrPartiallyUnavailable\n    return errors.As(err, &pe)\n}\n\nfunc isPermissionDenied(err error) bool {\n    if st, ok := status.FromError(errors.Unwrap(err)); ok {\n        return st.Code() == codes.PermissionDenied\n    }\n    return false\n}","tryCatchPattern":"instances, err := src.ListInstances(ctx)\nif err != nil {\n    if isPermissionDenied(err) {\n        return fmt.Errorf(\"check bigtable IAM roles for service account: %w\", err)\n    }\n    // transient: retry with backoff\n    return retryWithBackoff(func() error { _, err = src.ListInstances(ctx); return err })\n}","preventionTips":["Validate GOOGLE_APPLICATION_CREDENTIALS and project ID at startup, before making admin calls.","Give the runtime service account roles/bigtable.viewer at minimum.","Rely on the source's ErrPartiallyUnavailable handling; treat full list failures as environmental.","Add exponential backoff retry only for codes Unavailable/DeadlineExceeded/Internal."],"tags":["gcp","bigtable","admin-api","list-instances","error-wrapping"],"backgroundTag":"bigtable-admin-api-error","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"}