kubernetes/kops · error

error computing key fingerprint for SSH key: %v

Error message

error computing key fingerprint for SSH key: %v

What it means

Thrown during SSHKey.Run when the SSH public key resource was read successfully but pki.ComputeOpenSSHKeyFingerprint could not parse it into a valid OpenSSH public key. It fires when the key material is malformed, truncated, in an unsupported format (e.g. PEM instead of OpenSSH), or contains stray whitespace/newlines, so the fingerprint cannot be derived to compare against the stored KeyPairFingerPrint.

Source

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

	}

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

	return sshKey, nil
}

func (s *SSHKey) Run(c *fi.CloudupContext) error {
	if s.KeyPairFingerPrint == nil && s.PublicKey != nil {
		publicKey, err := fi.ResourceAsString(*s.PublicKey)
		if err != nil {
			return fmt.Errorf("error reading SSH public key: %w", err)
		}

		keyPairFingerPrint, err := pki.ComputeOpenSSHKeyFingerprint(publicKey)
		if err != nil {
			return fmt.Errorf("error computing key fingerprint for SSH key: %v", err)
		}
		klog.V(2).Infof("Computed SSH key fingerprint as %q", keyPairFingerPrint)
		s.KeyPairFingerPrint = &keyPairFingerPrint
	}
	return fi.CloudupDefaultDeltaRunMethod(s, c)
}

func (s *SSHKey) CheckChanges(actual, expected, changes *SSHKey) error {
	if actual != nil {
		if changes.Name != nil {
			return fi.CannotChangeField("Name")
		}
	}
	return nil
}

func (*SSHKey) RenderScw(t *scaleway.ScwAPITarget, actual, expected, changes *SSHKey) error {
	if actual != nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Regenerate the SSH public key in OpenSSH format (ssh-keygen -t ed25519) and update the key resource
  2. Inspect the key material for truncation, stray newlines, or PEM formatting and fix the source of the key
  3. Verify the resource supplying PublicKey actually yields the raw public key string and not an error page or path
Defensive patterns

Strategy: try-catch

When it happens

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