{"record":{"id":"8ccd8b0cea333d04","repo":"kubernetes/kops","slug":"must-specify-the-name-of-the-instance-group-to-del","errorCode":null,"errorMessage":"must specify the name of the instance group to delete","messagePattern":"must specify the name of the instance group to delete","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/delete_instancegroup.go","lineNumber":76,"sourceCode":"\nfunc NewCmdDeleteInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {\n\toptions := &DeleteInstanceGroupOptions{}\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"instancegroup INSTANCE_GROUP\",\n\t\tAliases: []string{\"instancegroups\", \"ig\"},\n\t\tShort:   deleteInstanceGroupShort,\n\t\tLong:    deleteInstanceGroupLong,\n\t\tExample: deleteInstanceGroupExample,\n\t\tArgs: func(cmd *cobra.Command, args []string) error {\n\t\t\toptions.ClusterName = rootCommand.ClusterName(true)\n\n\t\t\tif options.ClusterName == \"\" {\n\t\t\t\treturn fmt.Errorf(\"--name is required\")\n\t\t\t}\n\n\t\t\tif len(args) == 0 {\n\t\t\t\treturn fmt.Errorf(\"must specify the name of the instance group to delete\")\n\t\t\t}\n\n\t\t\toptions.GroupName = args[0]\n\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn fmt.Errorf(\"can only delete one instance group at a time\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tValidArgsFunction: completeInstanceGroup(f, nil, &[]string{kops.InstanceGroupRoleControlPlane.ToLowerString()}),\n\t\tRunE: func(cmd *cobra.Command, args []string) error {\n\t\t\tctx := cmd.Context()\n\n\t\t\tif !options.Yes {\n\t\t\t\tmessage := fmt.Sprintf(\"Do you really want to delete instance group %q? This action cannot be undone.\", options.GroupName)\n\n\t\t\t\tc := &ui.ConfirmArgs{","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/delete_instancegroup.go#L58-L94","documentation":"The cobra Args validator for `kops delete instancegroup` requires exactly one positional argument: the instance group name. When zero arguments are given, the command aborts with this error before any cluster API interaction.","triggerScenarios":"Running `kops delete instancegroup --name <cluster>` with no instance group name as a positional argument.","commonSituations":"User forgot the group name expecting a prompt; scripting where a variable holding the group name expanded to empty; confusing --name (cluster) with the instance group argument.","solutions":["Provide the group name: `kops delete instancegroup --name <cluster> <group-name>`.","List available groups first with `kops get instancegroups --name <cluster>` to confirm the exact name.","Guard the shell variable: `kops delete instancegroup --name \"$CLUSTER\" \"${GROUP:?group not set}\"`."],"exampleFix":"// before\n$ kops delete instancegroup --name prod.example.com\nerror: must specify the name of the instance group to delete\n// after\n$ kops delete instancegroup --name prod.example.com workers","handlingStrategy":"validation","validationCode":"GROUP=\"${1:?usage: kops-delete-ig <instance-group>}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check the group name exists with `kops get instancegroups` before deleting.","Use ${VAR:?} expansions in scripts so empty variables fail loudly.","Remember --name is the cluster, not the instance group."],"tags":["cli","kops","missing-argument","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"}