kubernetes/kops · error
error listing SSH keys: %w
Error message
error listing SSH keys: %w
What it means
SSHKey.find wraps GetByFingerprint errors other than the explicit 404 case. A 404 is handled separately (returns nil, or a named-key error when the key was supposed to exist); any other API failure (auth, throttling, network) is wrapped here while locating whether the cluster's SSH key already exists.
Source
Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:71
cloud := c.T.Cloud.(do.DOCloud)
return e.find(ctx, cloud)
}
func (e *SSHKey) find(ctx context.Context, cloud do.DOCloud) (*SSHKey, error) {
// We aren't allowed to have two keys with the same fingerprint here.
// So if we find a matching key, we use that one (with that name).
k, response, err := cloud.KeysService().GetByFingerprint(ctx, *e.KeyFingerprint)
if response.StatusCode == 404 {
if e.IsExistingKey() && *e.Name != "" {
return nil, fmt.Errorf("unable to find specified SSH key %q", *e.Name)
}
return nil, nil
}
if err != nil {
return nil, fmt.Errorf("error listing SSH keys: %w", err)
}
actual := &SSHKey{
ID: &k.ID,
Name: &k.Name,
KeyFingerprint: &k.Fingerprint,
}
if fi.ValueOf(actual.KeyFingerprint) == fi.ValueOf(e.KeyFingerprint) {
klog.V(2).Infof("SSH key fingerprints match; assuming public keys match")
actual.PublicKey = e.PublicKey
} else {
klog.V(2).Infof("Computed SSH key fingerprint mismatch: %q %q", fi.ValueOf(e.KeyFingerprint), fi.ValueOf(actual.KeyFingerprint))
}
actual.Lifecycle = e.Lifecycle
e.ID = actual.ID
if e.IsExistingKey() && *e.Name != "" {View on GitHub (pinned to 4c8573c808)
Solutions
- Check the DO API token and permissions
- Inspect the wrapped error for the DO API status
- Retry after transient failures
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:71 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/2ff4d25f220b177f.
Report an issue: GitHub.