kubernetes/kops · error
--name is required
Error message
--name is required
What it means
The create instancegroup command's argument validator found no cluster name: rootCommand.ClusterName(true) returned empty because neither a positional/flag cluster name nor a configured default exists. The command cannot proceed without knowing which cluster to add the IG to.
Source
Thrown at cmd/kops/create_instancegroup.go:100
// NewCmdCreateInstanceGroup create a new cobra command object for creating a instancegroup.
func NewCmdCreateInstanceGroup(f *util.Factory, out io.Writer) *cobra.Command {
options := &CreateInstanceGroupOptions{
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.ShellCompDirectiveNoFileCompView on GitHub (pinned to 4c8573c808)
Solutions
- Pass the cluster name via --name or the parent command configuration
- Set the cluster name in the kops configuration used by the CLI
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/kops/create_instancegroup.go:100 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/51ebb5b2583d18c7.
Report an issue: GitHub.