{"record":{"id":"db6d79ef677e2079","repo":"kubernetes/kops","slug":"must-specify-name-of-instance-group-to-create-db6d79","errorCode":null,"errorMessage":"must specify name of instance group to create","messagePattern":"must specify name of instance group to create","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/toolbox_instance-selector.go","lineNumber":130,"sourceCode":"func NewCmdToolboxInstanceSelector(f commandutils.Factory, out io.Writer) *cobra.Command {\n\toptions := &InstanceSelectorOptions{}\n\n\tcommandline := cli.New(\n\t\t\"instance-selector INSTANCE_GROUP\",\n\t\ttoolboxInstanceSelectorShort,\n\t\ttoolboxInstanceSelectorLong,\n\t\ttoolboxInstanceSelectorExample,\n\t\tnil,\n\t)\n\tcommandline.Command.Args = func(cmd *cobra.Command, args []string) error {\n\t\toptions.ClusterName = rootCommand.ClusterName(true)\n\n\t\tif options.ClusterName == \"\" {\n\t\t\treturn fmt.Errorf(\"--name is required\")\n\t\t}\n\n\t\tif len(args) == 0 {\n\t\t\treturn fmt.Errorf(\"must specify name of instance group to create\")\n\t\t}\n\n\t\toptions.InstanceGroupName = args[0]\n\n\t\tif len(args) != 1 {\n\t\t\treturn fmt.Errorf(\"can only create one instance group at a time\")\n\t\t}\n\n\t\tif err := processAndValidateFlags(&commandline); err != nil {\n\t\t\treturn err\n\t\t}\n\t\tsetInstanceSelectorOpts(options, &commandline)\n\n\t\treturn nil\n\t}\n\tcommandline.Command.ValidArgsFunction = func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\tcommandutils.ConfigureKlogForCompletion()\n\t\tif len(args) == 1 && rootCommand.ClusterName(false) == \"\" {","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/toolbox_instance-selector.go#L112-L148","documentation":"The command creates exactly one instance group whose name is given as the single positional argument. If no positional argument is supplied, Args validation returns this error telling the user to name the instance group to create.","triggerScenarios":"Running `kops toolbox instance-selector --name <cluster>` with no instance-group name argument.","commonSituations":"Assuming the tool only prints recommendations (without creating) and omitting the name; copy-pasting flag examples without the positional arg; wrapping scripts that drop args.","solutions":["Supply the instance group name: kops toolbox instance-selector nodes --name <cluster>","If you only want recommendations, check flags like --dry-run if available instead of omitting the name"],"exampleFix":"// before\nkops toolbox instance-selector --name mycluster.k8s.local\n// after\nkops toolbox instance-selector nodes --name mycluster.k8s.local","handlingStrategy":"validation","validationCode":"if [ -z \"$IG\" ]; then\n  echo \"usage: kops toolbox instance-selector <instance-group-name> --name <cluster>\" >&2\n  exit 2\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Include the positional instance-group name in all invocations","Check $# in shell wrappers before calling the command","Read `kops toolbox instance-selector --help` for arg order"],"tags":["cli","flag-validation","instance-selector","usage"],"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-12T07:17:12.445Z"}