{"record":{"id":"de8859235c49ed2d","repo":"kubernetes/kops","slug":"error-querying-for-address-q-v","errorCode":null,"errorMessage":"error querying for address %q: %v","messagePattern":"error querying for address %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/instance.go","lineNumber":95,"sourceCode":"\tactual := &Instance{}\n\tactual.Name = &r.Name\n\tactual.Tags = append(actual.Tags, r.Tags.Items...)\n\tactual.Zone = new(lastComponent(r.Zone))\n\tactual.MachineType = new(lastComponent(r.MachineType))\n\tactual.CanIPForward = &r.CanIpForward\n\tif r.Scheduling != nil {\n\t\tactual.Preemptible = &r.Scheduling.Preemptible\n\t}\n\tif len(r.NetworkInterfaces) != 0 {\n\t\tni := r.NetworkInterfaces[0]\n\t\tactual.Network = &Network{Name: new(lastComponent(ni.Network))}\n\t\tactual.StackType = &ni.StackType\n\t\tif len(ni.AccessConfigs) != 0 {\n\t\t\tac := ni.AccessConfigs[0]\n\t\t\tif ac.NatIP != \"\" {\n\t\t\t\taddrs, err := cloud.Compute().Addresses().ListWithFilter(cloud.Project(), cloud.Region(), \"address eq \"+ac.NatIP)\n\t\t\t\tif err != nil {\n\t\t\t\t\treturn nil, fmt.Errorf(\"error querying for address %q: %v\", ac.NatIP, err)\n\t\t\t\t} else if len(addrs) != 0 {\n\t\t\t\t\tactual.IPAddress = &Address{Name: &addrs[0].Name}\n\t\t\t\t} else {\n\t\t\t\t\treturn nil, fmt.Errorf(\"address not found %q: %v\", ac.NatIP, err)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tfor _, serviceAccount := range r.ServiceAccounts {\n\t\tfor _, scope := range serviceAccount.Scopes {\n\t\t\tactual.Scopes = append(actual.Scopes, scopeToShortForm(scope))\n\t\t}\n\t}\n\n\tactual.Disks = make(map[string]*Disk)\n\tfor i, disk := range r.Disks {\n\t\tif i == 0 {","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/instance.go#L77-L113","documentation":"While reconstructing the actual state of a GCE instance, kOps finds the instance's external NAT IP and queries static Addresses with a filter (address eq <NatIP>) to map the IP back to a static address resource. This error is thrown when that Addresses().ListWithFilter call fails.","triggerScenarios":"Addresses().ListWithFilter(project, region, \"address eq \"+ac.NatIP) returns an error — bad region, IAM permission denied on compute.addresses.list, API disabled, or transient API failure — while the instance has an AccessConfig with a NatIP.","commonSituations":"Region mismatch between instance and reserved addresses, service account lacking compute.addresses.list permission, Compute Engine API partially enabled, or network interruption during kops update cluster.","solutions":["Inspect the wrapped %v error for the underlying API cause","Verify the region: `gcloud compute addresses list --filter=\"address=<NatIP>\"` in the same region as the instance","Grant the kops service account compute.addresses.list permission (compute.networkViewer or compute.viewer)","Retry if transient"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Pre-check that the address filter query is serviceable\nresp, err := computeSvc.Addresses.List(project, region).Filter(\"address eq \"+natIP).Do()\nif err != nil {\n\tvar ge *googleapi.Error\n\tif errors.As(err, &ge) && ge.Code == 403 { /* fix IAM before proceeding */ }\n\treturn err\n}","typeGuard":"func isGoogleAPIErr(err error, code int) bool {\n\tvar ge *googleapi.Error\n\treturn errors.As(err, &ge) && ge.Code == code\n}","tryCatchPattern":"addrs, err := cloud.Compute().Addresses().ListWithFilter(cloud.Project(), cloud.Region(), \"address eq \"+ac.NatIP)\nif err != nil {\n\tif isGoogleAPIErr(err, 429) || isGoogleAPIErr(err, 500) {\n\t\treturn nil, retry.WithBackoff(err) // transient\n\t}\n\treturn nil, fmt.Errorf(\"error querying for address %q: %v\", ac.NatIP, err)\n}","preventionTips":["Keep instance region and reserved-address region consistent","Grant compute.addresses.list to the kops service account","Test the equivalent gcloud filter query first to separate IAM from logic issues","Rate-limit bulk refreshes to avoid 429s"],"tags":["gce","address","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"}