kubernetes/kops · error

must specify name of keyset to distrust keypair in

Error message

must specify name of keyset to distrust keypair in

What it means

Argument validation in `kops distrust keypair`: the command requires at least one positional argument naming the keyset (KEYSET, optionally followed by keypair IDs, or 'all'), and this guard fires when none are supplied. It is a usage error before any cluster API access.

Source

Thrown at cmd/kops/distrust_keypair.go:86

	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) {
			return completeDistrustKeyset(cmd.Context(), f, options, args, toComplete)
		},
		RunE: func(cmd *cobra.Command, args []string) error {
			return RunDistrustKeypair(cmd.Context(), f, out, options)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Specify a keyset name (e.g. 'kube-ca') or 'all': kops distrust keypair <keyset>
  2. List keysets with kops get keypairs if unsure of the name
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/distrust_keypair.go:86 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/73d81c92da2ea019. Report an issue: GitHub.