{"record":{"id":"f6e1a8ac97025414","repo":"kubernetes/kops","slug":"instancegroup-q-not-found","errorCode":null,"errorMessage":"InstanceGroup %q not found","messagePattern":"InstanceGroup %q not found","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instancegroup.go","lineNumber":145,"sourceCode":"\t\treturn fmt.Errorf(\"GroupName is required\")\n\t}\n\n\tcluster, err := GetCluster(ctx, f, options.ClusterName)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tclientset, err := f.KopsClient()\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tgroup, err := clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"error reading InstanceGroup %q: %v\", groupName, err)\n\t}\n\tif group == nil {\n\t\treturn fmt.Errorf(\"InstanceGroup %q not found\", groupName)\n\t}\n\n\tfmt.Fprintf(out, \"InstanceGroup %q found for deletion\\n\", groupName)\n\n\tif group.Spec.Role.HasControlPlane() {\n\t\tgroups, err := clientset.InstanceGroupsFor(cluster).List(ctx, metav1.ListOptions{})\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"listing InstanceGroups: %v\", err)\n\t\t}\n\n\t\tonlyMaster := true\n\t\tfor _, ig := range groups.Items {\n\t\t\tif ig.Name != groupName && ig.Spec.Role.HasControlPlane() {\n\t\t\t\tonlyMaster = false\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instancegroup.go#L127-L163","documentation":"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).","triggerScenarios":"InstanceGroupsFor(cluster).Get returns err == nil and group == nil for the requested groupName.","commonSituations":"Unusual clientset/backend implementations or cached clients that silently miss a group; racing with a concurrent delete that removed the group.","solutions":["Confirm the group name with `kops get instancegroups`","Re-run the command; if it persists, check the state store contents directly","Upgrade kOps if your storage backend consistently returns nil,nil"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"kops get instancegroups --name mycluster.k8s.local  # confirm group exists","typeGuard":null,"tryCatchPattern":"err := RunDeleteInstanceGroup(ctx, f, out, opts)\nif err != nil && strings.Contains(err.Error(), \"not found\") {\n    // group already gone; treat as idempotent success if appropriate\n}","preventionTips":["Treat not-found as idempotent success in cleanup scripts","Avoid concurrent deletes of the same instance group","Verify names against kops get output"],"tags":["cli","instancegroup","not-found"],"backgroundTag":"resource-not-found","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"}