{"record":{"id":"f9eecc5b9e4cdd5f","repo":"kubernetes/kops","slug":"must-specify-name-of-instance-group-to-create","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/create_instancegroup.go","lineNumber":104,"sourceCode":"\t\tRole: kopsapi.InstanceGroupRoleNode.ToLowerString(),\n\t\tEdit: true,\n\t}\n\n\tcmd := &cobra.Command{\n\t\tUse:     \"instancegroup INSTANCE_GROUP\",\n\t\tAliases: []string{\"instancegroups\", \"ig\"},\n\t\tShort:   createInstanceGroupShort,\n\t\tLong:    createInstanceGroupLong,\n\t\tExample: createInstanceGroupExample,\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 name of instance group to create\")\n\t\t\t}\n\n\t\t\toptions.InstanceGroupName = args[0]\n\n\t\t\tif len(args) != 1 {\n\t\t\t\treturn fmt.Errorf(\"can only create one instance group at a time\")\n\t\t\t}\n\n\t\t\treturn nil\n\t\t},\n\t\tValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\t\t\tcommandutils.ConfigureKlogForCompletion()\n\t\t\tif len(args) == 1 && rootCommand.ClusterName(false) == \"\" {\n\t\t\t\treturn []string{\"--name\"}, cobra.ShellCompDirectiveNoFileComp\n\t\t\t}\n\t\t\treturn nil, cobra.ShellCompDirectiveNoFileComp\n\t\t},\n\t\tRunE: func(cmd *cobra.Command, args []string) error {","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/create_instancegroup.go#L86-L122","documentation":"Argument validation in the cobra Args function of `kops create instancegroup`: the command requires exactly one positional argument (the instance group name), and this guard fires when zero arguments are supplied. It is a usage error, not an API failure — the user must run `kops create instancegroup INSTANCE_GROUP`.","triggerScenarios":"Thrown at cmd/kops/create_instancegroup.go:104 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide the instance group name: kops create instancegroup <name>","Use kops create ig <name> as the shorter alias"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}