{"record":{"id":"ffb0a9b13f2d358c","repo":"kubernetes/kops","slug":"error-reading-instancegroup-q-v","errorCode":null,"errorMessage":"error reading InstanceGroup %q: %v","messagePattern":"error reading InstanceGroup %q: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instancegroup.go","lineNumber":142,"sourceCode":"\t// TODO implement drain and validate logic\n\tgroupName := options.GroupName\n\tif groupName == \"\" {\n\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","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instancegroup.go#L124-L160","documentation":"After resolving the cluster, the command fetches the InstanceGroup from the kOps API. If the Get call returns an error (network, API failure, or not-found surfaced as an error), the command wraps it with the group name. The %v carries the underlying client error.","triggerScenarios":"clientset.InstanceGroupsFor(cluster).Get(ctx, groupName, ...) fails: cluster unreachable, wrong --name, or the group does not exist and the backend returns an error rather than nil.","commonSituations":"Typo in the instance group name; pointing at the wrong cluster; kOps state store permission problems; offline/etcd issues in the admin cluster.","solutions":["Run `kops get instancegroups --name <cluster>` to confirm the exact group name","Check the wrapped %v message for the root cause (not-found vs connection vs auth)","Verify --name/--state flags point at the intended cluster and state store"],"exampleFix":"// before\nkops delete instancegroup node --name mycluster.k8s.local\n// after (list to get exact name)\nkops get instancegroups --name mycluster.k8s.local\nkops delete instancegroup nodes --name mycluster.k8s.local","handlingStrategy":"try-catch","validationCode":"kops get instancegroups --name mycluster.k8s.local  # verify group exists first","typeGuard":null,"tryCatchPattern":"err := RunDeleteInstanceGroup(ctx, f, out, opts)\nif err != nil && strings.Contains(err.Error(), \"error reading InstanceGroup\") {\n    // inspect wrapped cause: not-found vs connection\n    log.Printf(\"instance group lookup failed: %v\", err)\n}","preventionTips":["Verify the exact group name with kops get instancegroups before deleting","Confirm --name/--state point at the intended cluster","Check state store connectivity and credentials before scripted deletes"],"tags":["cli","instancegroup","api"],"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"}