{"record":{"id":"ad8ff6e41dc79fc2","repo":"kubernetes/kops","slug":"error-finding-cloudinstancegroups-v","errorCode":null,"errorMessage":"error finding CloudInstanceGroups: %v","messagePattern":"error finding CloudInstanceGroups: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/instancegroups/delete.go","lineNumber":43,"sourceCode":"\tapi \"k8s.io/kops/pkg/apis/kops\"\n\t\"k8s.io/kops/pkg/client/simple\"\n\t\"k8s.io/kops/upup/pkg/fi\"\n)\n\n// DeleteInstanceGroup removes the cloud resources for an InstanceGroup\ntype DeleteInstanceGroup struct {\n\tCluster   *api.Cluster\n\tCloud     fi.Cloud\n\tClientset simple.Clientset\n}\n\n// DeleteInstanceGroup deletes a cloud instance group\nfunc (d *DeleteInstanceGroup) DeleteInstanceGroup(group *api.InstanceGroup) error {\n\tctx := context.TODO()\n\n\tgroups, err := d.Cloud.GetCloudGroups(d.Cluster, []*api.InstanceGroup{group}, false, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error finding CloudInstanceGroups: %v\", err)\n\t}\n\n\tfor _, g := range groups {\n\t\tif g.InstanceGroup == nil || g.InstanceGroup.Name != group.Name {\n\t\t\treturn fmt.Errorf(\"found group with unexpected name: %v\", g)\n\t\t}\n\t}\n\n\t// TODO should we drain nodes and validate the cluster?\n\tfor _, g := range groups {\n\t\tklog.Infof(\"Deleting %q\", group.ObjectMeta.Name)\n\n\t\terr = d.Cloud.DeleteGroup(g)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"error deleting cloud resources for InstanceGroup: %v\", err)\n\t\t}\n\t}\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/instancegroups/delete.go#L25-L61","documentation":"DeleteInstanceGroup first asks the cloud provider to enumerate the cloud groups backing the given InstanceGroup via Cloud.GetCloudGroups. If that cloud API call fails (auth issues, throttling, network, missing group), the error is wrapped and returned, and no deletion proceeds.","triggerScenarios":"Calling DeleteInstanceGroup with a Cloud whose GetCloudGroups call errors: invalid credentials, cloud API outage/rate limits, or referencing an instance group whose cloud resources were already removed.","commonSituations":"Running `kops delete ig` against a cluster whose autoscaling group was deleted out-of-band, expired AWS/GCP credentials, or network partition from the cloud API.","solutions":["Inspect the wrapped error to identify the cloud API failure and fix credentials/network","Verify the instance group still exists in the cloud console; if already deleted, skip cloud deletion","Retry after transient cloud API errors (throttling/outage) resolve"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// Pre-check that the cloud credentials and cluster metadata are set before deleting\nif d.Cloud == nil || d.Cluster == nil {\n\treturn fmt.Errorf(\"cloud and cluster must be initialized before DeleteInstanceGroup\")\n}","typeGuard":null,"tryCatchPattern":"err := d.DeleteInstanceGroup(ig)\nif err != nil && strings.Contains(err.Error(), \"error finding CloudInstanceGroups\") {\n\t// transient cloud API failure; back off and retry\n\ttime.Sleep(10 * time.Second)\n\terr = d.DeleteInstanceGroup(ig)\n}","preventionTips":["Verify cloud credentials before running delete operations","Confirm the instance group still exists in the cloud provider before deleting","Retry on throttling/transient errors with exponential backoff"],"tags":["cloud-api","instancegroups","delete","aws","gce"],"backgroundTag":"cloud-api-call-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"}