kubernetes/kops · error

cannot specify ID with "all"

Error message

cannot specify ID with "all"

What it means

The distrust keypair validator rejects combining the keyword 'all' with additional keypair ID arguments: 'all' distrusts every eligible keypair, so individual IDs are ambiguous/unnecessary in that form.

Source

Thrown at cmd/kops/distrust_keypair.go:92

	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)
		},
	}

	return cmd
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Use 'kops distrust keypair all' without extra IDs
  2. Or name a specific keyset followed by the IDs to distrust
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cmd/kops/distrust_keypair.go:92 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/18d675515046d2ab. Report an issue: GitHub.