kubernetes/kops · error
--name is required
Error message
--name is required
What it means
The distrust keypair command's argument validator found no cluster name: rootCommand.ClusterName(true) returned empty because neither --name nor a configured default cluster is available. The command needs to know which cluster's keystore to act on.
Source
Thrown at cmd/kops/distrust_keypair.go:82
type DistrustKeypairOptions struct {
ClusterName string
Keyset string
KeypairIDs []string
}
func NewCmdDistrustKeypair(f *util.Factory, out io.Writer) *cobra.Command {
options := &DistrustKeypairOptions{}
cmd := &cobra.Command{
Use: "keypair {KEYSET [ID]... | all}",
Short: distrustKeypairShort,
Long: distrustKeypairLong,
Example: distrustKeypairExample,
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 keyset to distrust keypair in")
}
options.Keyset = args[0]
if len(args) > 1 {
if options.Keyset == "all" {
return fmt.Errorf("cannot specify ID with \"all\"")
}
options.KeypairIDs = args[1:]
}
return nil
},
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {View on GitHub (pinned to 4c8573c808)
Solutions
- Pass --name <clustername> to the command
- Configure a default cluster name for the kops CLI
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at cmd/kops/distrust_keypair.go:82 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/a6218f4faa968ded.
Report an issue: GitHub.