kubernetes/kops · error

must specify the name of the instance group to edit

Error message

must specify the name of the instance group to edit

What it means

Argument validation in `kops edit instancegroup`: the command requires exactly one positional argument (the instance group name to edit), and this guard fires when zero arguments are passed. The name must also be accompanied by a cluster via --name or the current context.

Source

Thrown at cmd/kops/edit_instancegroup.go:93

func NewCmdEditInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
	options := &EditInstanceGroupOptions{}

	cmd := &cobra.Command{
		Use:     "instancegroup INSTANCE_GROUP",
		Aliases: []string{"instancegroups", "ig"},
		Short:   editInstancegroupShort,
		Long:    editInstancegroupLong,
		Example: editInstancegroupExample,
		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 the name of the instance group to edit")
			}

			options.GroupName = args[0]

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

			return nil
		},
		ValidArgsFunction: completeInstanceGroup(f, nil, nil),
		RunE: func(cmd *cobra.Command, args []string) error {
			return RunEditInstanceGroup(cmd.Context(), f, out, options)
		},
	}

	LazyQuoteStringSliceVar(cmd.Flags(), &options.Sets, "set", options.Sets, "Directly set values in the spec")
	cmd.RegisterFlagCompletionFunc("set", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Provide the instance group name: kops edit instancegroup <name>
  2. List instance groups with kops get ig to find the name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/edit_instancegroup.go:93 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/754a57043013fc87. Report an issue: GitHub.