{"record":{"id":"34ab80f49cfe63c4","repo":"kubernetes/kops","slug":"error-finding-address-with-ip-q-w","errorCode":null,"errorMessage":"error finding Address with IP=%q: %w","messagePattern":"error finding Address with IP=%q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/forwardingrule.go","lineNumber":111,"sourceCode":"\t\tName:       new(r.Name),\n\t\tIPProtocol: r.IPProtocol,\n\t}\n\tif r.PortRange != \"\" {\n\t\tactual.PortRange = &r.PortRange\n\t}\n\tif len(r.Ports) > 0 {\n\t\tactual.Ports = r.Ports\n\t}\n\n\tif r.Target != \"\" {\n\t\tactual.TargetPool = &TargetPool{\n\t\t\tName: new(lastComponent(r.Target)),\n\t\t}\n\t}\n\tif r.IPAddress != \"\" {\n\t\taddress, err := findAddressByIP(cloud, r.IPAddress, r.Subnetwork)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error finding Address with IP=%q: %w\", r.IPAddress, err)\n\t\t}\n\t\tactual.IPAddress = address\n\t}\n\tif r.BackendService != \"\" {\n\t\tactual.BackendService = &BackendService{\n\t\t\tName: new(lastComponent(r.BackendService)),\n\t\t}\n\t}\n\tif r.LoadBalancingScheme != \"\" {\n\t\tactual.LoadBalancingScheme = new(r.LoadBalancingScheme)\n\t}\n\tif r.Network != \"\" {\n\t\tactual.Network = &Network{\n\t\t\tName: new(lastComponent(r.Network)),\n\t\t}\n\t}\n\tif r.Subnetwork != \"\" {\n\t\tactual.Subnetwork = &Subnet{","sourceCodeStart":93,"sourceCodeEnd":129,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/forwardingrule.go#L93-L129","documentation":"After fetching the forwarding rule, Find() resolves its IP address to a GCE static Address resource via findAddressByIP(). If that helper fails (non-NotFound API error), the error is wrapped with %w preserving the cause. This blocks reconciling the forwarding rule's actual state.","triggerScenarios":"findAddressByIP returns an error other than not-found — typically a Compute API failure while listing/getting Addresses in the region, or an address in an unexpected project/scope (global vs regional).","commonSituations":"The IP is a global address but lookup is regional (or vice versa); IAM lacks compute.addresses.list; the forwarding rule references an ephemeral IP with no Address resource and the lookup API call still errors.","solutions":["Follow the wrapped cause (%w) to the underlying findAddressByIP error.","Confirm the IP is a static Address in the same region as the forwarding rule; create one if it is ephemeral.","Check IAM permissions for compute.addresses.get/list.","Re-run after verifying project/region configuration if the cause is an API error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before applying, ensure the forwarding rule's IP is a static regional address:\n// gcloud compute addresses list --filter=\"address=IP AND region=R\"\nfunc hasStaticAddress(ips []cloudresourcemanager.Binding, ip, region string) bool { /* query Addresses API; return false if empty */ ; return false }","typeGuard":"func isRegionalAddress(addr *compute.Address, region string) bool {\n  return addr != nil && addr.Region != \"\" && strings.HasSuffix(addr.Region, \"/regions/\"+region) && addr.Address != \"\"\n}","tryCatchPattern":null,"preventionTips":["Reserve a static regional Address before referencing its IP in a forwarding rule.","Do not mix global and regional addresses; LB type dictates scope.","Grant compute.addresses.get/list to the kops service account."],"tags":["gce","load-balancer","address","api-error"],"backgroundTag":"address-lookup-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"}