{"record":{"id":"c2ec5258ca862286","repo":"kubernetes/kops","slug":"error-deleting-address-s-v","errorCode":null,"errorMessage":"error deleting Address %s: %v","messagePattern":"error deleting Address (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/resources/gce/gce.go","lineNumber":876,"sourceCode":"}\n\nfunc deleteAddress(cloud fi.Cloud, r *resources.Resource) error {\n\tc := cloud.(gce.GCECloud)\n\tt := r.Obj.(*compute.Address)\n\n\tklog.V(2).Infof(\"Deleting GCE Address %s\", t.SelfLink)\n\tu, err := gce.ParseGoogleCloudURL(t.SelfLink)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\top, err := c.Compute().Addresses().Delete(u.Project, u.Region, u.Name)\n\tif err != nil {\n\t\tif gce.IsNotFound(err) {\n\t\t\tklog.Infof(\"Address not found, assuming deleted: %q\", t.SelfLink)\n\t\t\treturn nil\n\t\t}\n\t\treturn fmt.Errorf(\"error deleting Address %s: %v\", t.SelfLink, err)\n\t}\n\n\treturn c.WaitForOp(op)\n}\n\nfunc (d *clusterDiscoveryGCE) listSubnets() ([]*resources.Resource, error) {\n\t// Templates are very accurate because of the metadata, so use those as the sanity check\n\ttemplates, err := d.findInstanceTemplates()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tsubnetworkUrls := make(map[string]bool)\n\tfor _, t := range templates {\n\t\tfor _, ni := range t.Properties.NetworkInterfaces {\n\t\t\tif ni.Subnetwork != \"\" {\n\t\t\t\tsubnetworkUrls[ni.Subnetwork] = true\n\t\t\t}\n\t\t}","sourceCodeStart":858,"sourceCodeEnd":894,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/resources/gce/gce.go#L858-L894","documentation":"Wraps a failure from Compute Addresses().Delete in deleteAddress during cluster teardown. NotFound is treated as success; other failures surface with the address SelfLink and raw error. The most characteristic cause is a 412/400 conflict because the address is still reserved/in-use by a forwarding rule or VM that hasn't been deleted yet.","triggerScenarios":"c.Compute().Addresses().Delete(u.Project, u.Region, u.Name) returns 403 permission denied, 409/412 in-use by another resource, 429 rate limit, or 5xx. Ordering issues in teardown (load balancer still holding the IP) trigger this most often.","commonSituations":"Static IP still attached to a surviving load balancer/forwarding rule after partial teardown failure; shared VPC IAM gaps; concurrent kops delete runs; credential rotation mid-deletion.","solutions":["Delete the load balancer/forwarding rule holding the IP first, then re-run kops delete cluster (teardown is resumable).","Check for other resources using the address in the GCP console (VPC network > IP addresses shows in-use status).","Verify compute.addresses.delete IAM permission on the project.","Retry on 429/5xx after a short backoff.","If truly orphaned, release the address in the console and remove it from a manual resource-tracking run."],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// check the address is not still in use before delete\naddr, err := computeService.Addresses.Get(project, region, addrName).Do()\nif err == nil && addr.Status == \"IN_USE\" {\n    return fmt.Errorf(\"address %s still in use by %s; delete the LB first\", addrName, addr.Users)\n}","typeGuard":"func isGCEAPIError(err error) (*googleapi.Error, bool) {\n    var gerr *googleapi.Error\n    return gerr, errors.As(err, &gerr)\n}","tryCatchPattern":"err := deleteAddress(t)\nvar gerr *googleapi.Error\nif err != nil {\n    if errors.As(err, &gerr) && gerr.Code == 404 { return nil } // already gone\n    if errors.As(err, &gerr) && (gerr.Code == 409 || gerr.Code == 412 || gerr.Code == 429 || gerr.Code >= 500) {\n        // dependent LB still alive or transient — backoff and retry\n    }\n    return err\n}","preventionTips":["Delete load balancers/forwarding rules before static addresses","Inspect addr.Users in the console to find what holds the IP","Re-run kops delete cluster after fixing partial failures — 404 is success","Grant compute.addresses.delete IAM before teardown","Never run concurrent teardowns against the same cluster"],"tags":["gce","gcp","addresses","delete","teardown"],"backgroundTag":"gcp-resource-delete-conflict","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}