kubernetes/kops · error

found multiple SSH keys named %q

Error message

found multiple SSH keys named %q

What it means

Uniqueness validation in the SSHKey task's Find: ListSSHKeys returned more than one key with the same name in the IAM account, so kOps cannot decide which key the cluster spec refers to. Typically caused by re-running creation under different projects or manually duplicated keys.

Source

Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:61

func (s *SSHKey) CompareWithID() *string {
	return s.Name
}

func (s *SSHKey) Find(c *fi.CloudupContext) (*SSHKey, error) {
	cloud := c.T.Cloud.(scaleway.ScwCloud)

	keysResp, err := cloud.IamService().ListSSHKeys(&iam.ListSSHKeysRequest{
		Name: s.Name,
	}, scw.WithAllPages())
	if err != nil {
		return nil, fmt.Errorf("error listing SSH keys: %v", err)
	}
	if keysResp.TotalCount == 0 {
		return nil, nil
	}
	if keysResp.TotalCount != 1 {
		return nil, fmt.Errorf("found multiple SSH keys named %q", *s.Name)
	}

	klog.V(2).Infof("found matching SSH key named %q", *s.Name)
	k := keysResp.SSHKeys[0]
	sshKey := &SSHKey{
		ID:                 new(k.ID),
		Name:               new(k.Name),
		KeyPairFingerPrint: new(k.Fingerprint),
		Lifecycle:          s.Lifecycle,
	}

	// Avoid spurious changes
	if !strings.Contains(fi.ValueOf(sshKey.KeyPairFingerPrint), fi.ValueOf(s.KeyPairFingerPrint)) {
		return nil, fmt.Errorf("computed SSH key fingerprint mismatch: %q %q", fi.ValueOf(s.KeyPairFingerPrint), fi.ValueOf(sshKey.KeyPairFingerPrint))
	}

	klog.V(2).Infof("SSH key fingerprints match; assuming public keys match")
	sshKey.PublicKey = s.PublicKey

View on GitHub (pinned to 4c8573c808)

Solutions

  1. List SSH keys with the Scaleway CLI and delete the stale duplicate
  2. Keep exactly one key with that name in the account
  3. Re-run the kOps operation
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at upup/pkg/fi/cloudup/scalewaytasks/sshkey.go:61 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/70c7472907f21d4d. Report an issue: GitHub.