kubernetes/kops · error

must specify name of instance group to create

Error message

must specify name of instance group to create

What it means

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`.

Source

Thrown at cmd/kops/create_instancegroup.go:104

		Role: kopsapi.InstanceGroupRoleNode.ToLowerString(),
		Edit: true,
	}

	cmd := &cobra.Command{
		Use:     "instancegroup INSTANCE_GROUP",
		Aliases: []string{"instancegroups", "ig"},
		Short:   createInstanceGroupShort,
		Long:    createInstanceGroupLong,
		Example: createInstanceGroupExample,
		Args: func(cmd *cobra.Command, args []string) error {
			options.ClusterName = rootCommand.ClusterName(true)

			if options.ClusterName == "" {
				return fmt.Errorf("--name is required")
			}

			if len(args) == 0 {
				return fmt.Errorf("must specify name of instance group to create")
			}

			options.InstanceGroupName = args[0]

			if len(args) != 1 {
				return fmt.Errorf("can only create one instance group at a time")
			}

			return nil
		},
		ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
			commandutils.ConfigureKlogForCompletion()
			if len(args) == 1 && rootCommand.ClusterName(false) == "" {
				return []string{"--name"}, cobra.ShellCompDirectiveNoFileComp
			}
			return nil, cobra.ShellCompDirectiveNoFileComp
		},
		RunE: func(cmd *cobra.Command, args []string) error {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Provide the instance group name: kops create instancegroup <name>
  2. Use kops create ig <name> as the shorter alias
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/create_instancegroup.go:104 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/f9eecc5b9e4cdd5f. Report an issue: GitHub.