kubernetes/kops · error

found group with unexpected name

Error message

found group with unexpected name: %v

What it means

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.

Solutions

  1. Compare the printed group name with the requested instance group name to find the mismatch
  2. Delete or reconcile the orphaned/mismatched cloud group manually, then retry
  3. Check the cloud provider's GetCloudGroups implementation if it mis-links groups
Defensive patterns

Strategy: validation

Validate before calling

// Pre-check that the requested group name is consistent with the cloud state
_, err := cloud.GetCloudGroups(cluster, []*api.InstanceGroup{group}, false, nil)
if err == nil {
	log.Printf("verified cloud group matches instance group %q before delete", group.Name)
}

Try / catch

err := d.DeleteInstanceGroup(group)
if err != nil && strings.Contains(err.Error(), "found group with unexpected name") {
	log.Fatalf("cloud state out of sync with instance group %q: %v", group.Name, err)
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/248422cc411aec9d. Report an issue: GitHub.

Appendix: source

Thrown at pkg/instancegroups/delete.go:48

// DeleteInstanceGroup removes the cloud resources for an InstanceGroup
type DeleteInstanceGroup struct {
	Cluster   *api.Cluster
	Cloud     fi.Cloud
	Clientset simple.Clientset
}

// DeleteInstanceGroup deletes a cloud instance group
func (d *DeleteInstanceGroup) DeleteInstanceGroup(group *api.InstanceGroup) error {
	ctx := context.TODO()

	groups, err := d.Cloud.GetCloudGroups(d.Cluster, []*api.InstanceGroup{group}, false, nil)
	if err != nil {
		return fmt.Errorf("error finding CloudInstanceGroups: %v", err)
	}

	for _, g := range groups {
		if g.InstanceGroup == nil || g.InstanceGroup.Name != group.Name {
			return fmt.Errorf("found group with unexpected name: %v", g)
		}
	}

	// TODO should we drain nodes and validate the cluster?
	for _, g := range groups {
		klog.Infof("Deleting %q", group.ObjectMeta.Name)

		err = d.Cloud.DeleteGroup(g)
		if err != nil {
			return fmt.Errorf("error deleting cloud resources for InstanceGroup: %v", err)
		}
	}

	err = d.Clientset.InstanceGroupsFor(d.Cluster).Delete(ctx, group.ObjectMeta.Name, metav1.DeleteOptions{})
	if err != nil {
		return err
	}

View on GitHub (pinned to 4c8573c808)