kubernetes/kops · error

cannot specify ID with "all"

Error message

cannot specify ID with "all"

What it means

The promote keypair validator rejects combining the keyword 'all' with an explicit keypair ID argument: 'all' promotes every rotatable keyset's primary, so an individual ID is not meaningful in that form.

Source

Thrown at cmd/kops/promote_keypair.go:96

		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 promote keypair in")
			}

			options.Keyset = args[0]

			if len(args) > 2 {
				return fmt.Errorf("can only promote to one keyset at a time")
			}
			if len(args) > 1 {
				if options.Keyset == "all" {
					return fmt.Errorf("cannot specify ID with \"all\"")
				}

				options.KeypairID = args[1]
			}

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

	return cmd
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Drop the ID: `kops promote keypair all --name <cluster>`
  2. If you need to promote a specific ID, name the keyset explicitly: `kops promote keypair kubernetes-ca 3 --name <cluster>`
  3. Fix the script so the ID argument is omitted when keyset is "all"

Example fix

// before
kops promote keypair all 2024-01-01-00-00-00 --name c
// after
kops promote keypair all --name c
Defensive patterns

Strategy: validation

Validate before calling

if [ "$KEYSET" = "all" ] && [ -n "$KEYPAIR_ID" ]; then echo "cannot combine 'all' with an ID"; exit 1; fi

Prevention

When it happens

Trigger: Running `kops promote keypair all <ID> --name <cluster>` — i.e. keyset "all" with a second positional argument interpreted as the keypair ID.

Common situations: Reusing a command template that had a hardcoded ID while switching the keyset to "all"; scripting that always appends an ID variable even when empty-checks fail.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/4fa22b9b29c8f4cc. Report an issue: GitHub.