{"record":{"id":"248422cc411aec9d","repo":"kubernetes/kops","slug":"found-group-with-unexpected-name-v","errorCode":null,"errorMessage":"found group with unexpected name: %v","messagePattern":"found group with unexpected name: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/instancegroups/delete.go","lineNumber":48,"sourceCode":"// 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\n\terr = d.Clientset.InstanceGroupsFor(d.Cluster).Delete(ctx, group.ObjectMeta.Name, metav1.DeleteOptions{})\n\tif err != nil {\n\t\treturn err\n\t}\n","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/instancegroups/delete.go#L30-L66","documentation":"After GetCloudGroups returns, DeleteInstanceGroup sanity-checks that every returned cloud group maps back to the requested InstanceGroup name. A mismatch (nil InstanceGroup link or different name) means the cloud enumerator returned something unexpected, so it aborts rather than deleting the wrong resources.","triggerScenarios":"GetCloudGroups returns groups whose .InstanceGroup is nil or whose name differs from the api.InstanceGroup passed in — e.g. a stale/mismatched cloud group or a provider bug in group-to-IG matching.","commonSituations":"Renaming an instance group in kOps while the old cloud group still exists, cloud provider returning related autoscaling groups, or provider mapping code failing to back-fill the InstanceGroup pointer.","solutions":["Compare the printed group name with the requested instance group name to find the mismatch","Delete or reconcile the orphaned/mismatched cloud group manually, then retry","Check the cloud provider's GetCloudGroups implementation if it mis-links groups"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Pre-check that the requested group name is consistent with the cloud state\n_, err := cloud.GetCloudGroups(cluster, []*api.InstanceGroup{group}, false, nil)\nif err == nil {\n\tlog.Printf(\"verified cloud group matches instance group %q before delete\", group.Name)\n}","typeGuard":null,"tryCatchPattern":"err := d.DeleteInstanceGroup(group)\nif err != nil && strings.Contains(err.Error(), \"found group with unexpected name\") {\n\tlog.Fatalf(\"cloud state out of sync with instance group %q: %v\", group.Name, err)\n}","preventionTips":["Never rename kops instance groups without reconciling cloud resources","Investigate stale/orphaned cloud groups via the cloud console","Keep provider GetCloudGroups mapping logic in sync with kOps versions"],"tags":["instancegroups","delete","cloud-api","name-mismatch"],"backgroundTag":"unexpected-cloud-resource-name","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"}