{"record":{"id":"b7a1507f2c4cacc5","repo":"kubernetes/kops","slug":"groupname-is-required","errorCode":null,"errorMessage":"GroupName is required","messagePattern":"GroupName is required","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instancegroup.go","lineNumber":127,"sourceCode":"\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn RunDeleteInstanceGroup(ctx, f, out, options)\n\t\t},\n\t}\n\n\tcmd.Flags().BoolVarP(&options.Yes, \"yes\", \"y\", options.Yes, \"Specify --yes to immediately delete the instance group\")\n\n\treturn cmd\n}\n\n// RunDeleteInstanceGroup runs the deletion of an instance group\nfunc RunDeleteInstanceGroup(ctx context.Context, f *util.Factory, out io.Writer, options *DeleteInstanceGroupOptions) error {\n\t// TODO make this drain and validate the ig?\n\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)","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instancegroup.go#L109-L145","documentation":"RunDeleteInstanceGroup requires the name of the instance group to delete via options.GroupName. If it is empty, the command aborts immediately before contacting the cluster. This is a mandatory-input guard in the kOps CLI.","triggerScenarios":"Calling `kops delete instancegroup` (or RunDeleteInstanceGroup programmatically) without a positional group-name argument and without --name, so options.GroupName resolves to \"\".","commonSituations":"Typing `kops delete instancegroup` with no argument; scripting the command with a shell variable that is empty; forgetting that --name sets the cluster, not the group.","solutions":["Pass the instance group name as a positional argument: kops delete instancegroup <name> --name <cluster>","Verify the group exists with `kops get instancegroups` and re-run with the exact name","In code, set DeleteInstanceGroupOptions.GroupName before calling RunDeleteInstanceGroup"],"exampleFix":"// before\nkops delete instancegroup --name mycluster.k8s.local\n// after\nkops delete instancegroup nodes --name mycluster.k8s.local","handlingStrategy":"validation","validationCode":"if options.GroupName == \"\" {\n    return fmt.Errorf(\"GroupName is required\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass the instance group name as a positional argument","Guard shell variables with ${IG:?} before interpolating into the command","List groups with `kops get instancegroups` to confirm names before deleting"],"tags":["cli","instancegroup","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}