{"record":{"id":"2ff4d25f220b177f","repo":"kubernetes/kops","slug":"error-listing-ssh-keys-w","errorCode":null,"errorMessage":"error listing SSH keys: %w","messagePattern":"error listing SSH keys: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/dotasks/sshkey.go","lineNumber":71,"sourceCode":"\n\tcloud := c.T.Cloud.(do.DOCloud)\n\n\treturn e.find(ctx, cloud)\n}\n\nfunc (e *SSHKey) find(ctx context.Context, cloud do.DOCloud) (*SSHKey, error) {\n\t// We aren't allowed to have two keys with the same fingerprint here.\n\t// So if we find a matching key, we use that one (with that name).\n\n\tk, response, err := cloud.KeysService().GetByFingerprint(ctx, *e.KeyFingerprint)\n\tif response.StatusCode == 404 {\n\t\tif e.IsExistingKey() && *e.Name != \"\" {\n\t\t\treturn nil, fmt.Errorf(\"unable to find specified SSH key %q\", *e.Name)\n\t\t}\n\t\treturn nil, nil\n\t}\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error listing SSH keys: %w\", err)\n\t}\n\n\tactual := &SSHKey{\n\t\tID:             &k.ID,\n\t\tName:           &k.Name,\n\t\tKeyFingerprint: &k.Fingerprint,\n\t}\n\n\tif fi.ValueOf(actual.KeyFingerprint) == fi.ValueOf(e.KeyFingerprint) {\n\t\tklog.V(2).Infof(\"SSH key fingerprints match; assuming public keys match\")\n\t\tactual.PublicKey = e.PublicKey\n\t} else {\n\t\tklog.V(2).Infof(\"Computed SSH key fingerprint mismatch: %q %q\", fi.ValueOf(e.KeyFingerprint), fi.ValueOf(actual.KeyFingerprint))\n\t}\n\tactual.Lifecycle = e.Lifecycle\n\n\te.ID = actual.ID\n\tif e.IsExistingKey() && *e.Name != \"\" {","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/dotasks/sshkey.go#L53-L89","documentation":"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.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/dotasks/sshkey.go:71 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the DO API token and permissions","Inspect the wrapped error for the DO API status","Retry after transient failures"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}