{"record":{"id":"b9d4072a7b75776a","repo":"kubernetes/kops","slug":"error-getting-targetpool-q-w","errorCode":null,"errorMessage":"error getting TargetPool %q: %w","messagePattern":"error getting TargetPool %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/gce/gce.go","lineNumber":616,"sourceCode":"\t\t\t}\n\t\t\tif forwardingRule.Target != \"\" {\n\t\t\t\tforwardingRuleResource.Blocks = append(forwardingRuleResource.Blocks, typeTargetPool+\":\"+gce.LastComponent(forwardingRule.Target))\n\t\t\t}\n\t\t\tk8sResources = append(k8sResources, forwardingRuleResource)\n\n\t\t\t// TODO: Can we get k8s to set labels on the ForwardingRule?\n\n\t\t\t// TODO: Check description?  It looks like e.g. description: '{\"kubernetes.io/service-name\":\"kube-system/guestbook\"}'\n\n\t\t\tif forwardingRule.Target == \"\" {\n\t\t\t\tklog.Warningf(\"forwarding rule %q did not have target, assuming firewallRule %q is not a k8s rule\", forwardingRuleName, firewallRule.Name)\n\t\t\t\tcontinue nextFirewallRule\n\t\t\t}\n\n\t\t\ttargetPoolName := gce.LastComponent(forwardingRule.Target)\n\t\t\ttargetPool, err := c.Compute().TargetPools().Get(c.Project(), c.Region(), targetPoolName)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, fmt.Errorf(\"error getting TargetPool %q: %w\", targetPoolName, err)\n\t\t\t}\n\n\t\t\ttargetPoolResource := &resources.Resource{\n\t\t\t\tName:    targetPool.Name,\n\t\t\t\tID:      targetPool.Name,\n\t\t\t\tType:    typeTargetPool,\n\t\t\t\tDeleter: deleteTargetPool,\n\t\t\t\tObj:     targetPool,\n\t\t\t}\n\t\t\tk8sResources = append(k8sResources, targetPoolResource)\n\n\t\t\t// TODO: Check description? (looks like description: '{\"kubernetes.io/service-name\":\"k8s-dbb09d49d9780e7e-node\"}' )\n\n\t\t\t// TODO: Check instances?\n\n\t\t\tfor _, healthCheckLink := range targetPool.HealthChecks {\n\t\t\t\t// l4 level healthchecks\n","sourceCodeStart":598,"sourceCodeEnd":634,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/gce/gce.go#L598-L634","documentation":"This error wraps a non-NotFound failure from the Compute TargetPools().Get API during listFirewallRules. After resolving the forwarding rule, kOps looks up its target pool to discover associated health checks; any API failure other than a handled case aborts discovery with this wrapped message. The target pool name is derived from forwardingRule.Target via gce.LastComponent.","triggerScenarios":"c.Compute().TargetPools().Get(project, region, targetPoolName) fails with permission denied, rate limiting, transient 5xx, or a malformed/foreign Target link on the forwarding rule that yields a name that cannot be fetched (e.g. pointing to another project or a legacy target).","commonSituations":"Forwarding rule was created outside kOps and points at a target pool in another project or region; IAM role stripped from the kops service account; GCE API transient outage mid-deletion; project ID mismatch after reconfiguring credentials.","solutions":["Retry the command; many failures are transient API/5xx issues.","Verify compute.targetPools.get IAM permission for the credentials in use.","Inspect the forwarding rule's target link in the GCP console; if it references another project/region, the firewall rule is not a kOps rule — delete it manually.","Check c.Region() matches the target pool's region (target pools are regional).","Use errors.As on the wrapped error to identify the exact Google API status."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// verify the forwarding rule's target resolves within the expected project/region\ntl, err := computeService.ForwardingRules.Get(project, region, frName).Do()\nif err == nil && tl.Target != \"\" {\n    if !strings.Contains(tl.Target, \"projects/\"+project+\"/\") {\n        return fmt.Errorf(\"forwarding rule %s targets another project: %s\", frName, tl.Target)\n    }\n}","typeGuard":"func isGCEAPIError(err error) (*googleapi.Error, bool) {\n    var gerr *googleapi.Error\n    return gerr, errors.As(err, &gerr)\n}","tryCatchPattern":"pools, err := listFirewallRules(ctx, c)\nif err != nil {\n    var gerr *googleapi.Error\n    if errors.As(err, &gerr) && gerr.Code == 404 {\n        return nil // treat as nothing to clean up\n    }\n    return err\n}","preventionTips":["Never hand-edit forwarding rule target links across projects/regions","Ensure compute.targetPools.get permission for the service account","Target pools are regional — confirm region matches the forwarding rule","Retry transient 429/5xx with backoff","Audit load balancer resources in the console before running kops delete cluster"],"tags":["gce","gcp","target-pool","api-error"],"backgroundTag":"gce-api-request-failed","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}