kubernetes/kops · error

InstanceGroup %q not found

Error message

InstanceGroup %q not found

What it means

Defensive check: if the client returns both a nil error and a nil group, the command reports the group as not found. In practice most backends return an error for missing groups, so this path is rare, but it guards against implementations that return (nil, nil).

Source

Thrown at cmd/kops/delete_instancegroup.go:145

		return fmt.Errorf("GroupName is required")
	}

	cluster, err := GetCluster(ctx, f, options.ClusterName)
	if err != nil {
		return err
	}

	clientset, err := f.KopsClient()
	if err != nil {
		return err
	}

	group, err := clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, metav1.GetOptions{})
	if err != nil {
		return fmt.Errorf("error reading InstanceGroup %q: %v", groupName, err)
	}
	if group == nil {
		return fmt.Errorf("InstanceGroup %q not found", groupName)
	}

	fmt.Fprintf(out, "InstanceGroup %q found for deletion\n", groupName)

	if group.Spec.Role.HasControlPlane() {
		groups, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})
		if err != nil {
			return fmt.Errorf("listing InstanceGroups: %v", err)
		}

		onlyMaster := true
		for _, ig := range groups.Items {
			if ig.Name != groupName && ig.Spec.Role.HasControlPlane() {
				onlyMaster = false
				break
			}
		}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Confirm the group name with `kops get instancegroups`
  2. Re-run the command; if it persists, check the state store contents directly
  3. Upgrade kOps if your storage backend consistently returns nil,nil
Defensive patterns

Strategy: try-catch

Validate before calling

kops get instancegroups --name mycluster.k8s.local  # confirm group exists

Try / catch

err := RunDeleteInstanceGroup(ctx, f, out, opts)
if err != nil && strings.Contains(err.Error(), "not found") {
    // group already gone; treat as idempotent success if appropriate
}

Prevention

When it happens

Trigger: InstanceGroupsFor(cluster).Get returns err == nil and group == nil for the requested groupName.

Common situations: Unusual clientset/backend implementations or cached clients that silently miss a group; racing with a concurrent delete that removed the group.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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