{"record":{"id":"b291cd7f8cfb49ac","repo":"kubernetes/kops","slug":"error-rendering-ssh-key-data-w-b291cd","errorCode":null,"errorMessage":"error rendering SSH key data: %w","messagePattern":"error rendering SSH key data: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/linodetasks/sshkey.go","lineNumber":83,"sourceCode":"\t\t\treturn nil, fmt.Errorf(\"found multiple SSH keys named %q\", name)\n\t\t}\n\t\tmatched = key\n\t}\n\n\tif matched == nil {\n\t\treturn nil, nil\n\t}\n\n\tactual := &SSHKey{\n\t\tID:        new(matched.ID),\n\t\tName:      new(matched.Label),\n\t\tLifecycle: s.Lifecycle,\n\t}\n\n\tif s.PublicKey != nil {\n\t\texpectedPublicKey, err := fi.ResourceAsString(*s.PublicKey)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error rendering SSH key data: %w\", err)\n\t\t}\n\n\t\tif strings.TrimSpace(expectedPublicKey) != strings.TrimSpace(matched.SSHKey) {\n\t\t\treturn nil, fmt.Errorf(\"found SSH key %q in Akamai (Linode), but public key data did not match\", name)\n\t\t}\n\n\t\t// Avoid spurious changes.\n\t\tactual.PublicKey = s.PublicKey\n\t}\n\n\treturn actual, nil\n}\n\nfunc (e *SSHKey) Run(c *fi.CloudupContext) error {\n\treturn fi.CloudupDefaultDeltaRunMethod(e, c)\n}\n\nfunc (_ *SSHKey) CheckChanges(actual, expected, changes *SSHKey) error {","sourceCodeStart":65,"sourceCodeEnd":101,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/linodetasks/sshkey.go#L65-L101","documentation":"When Find() locates a matching SSH key in Linode, it renders the task's local PublicKey resource to a string to compare against the remote key. If reading/rendering the local resource fails (unreadable file, parse error), the error is wrapped with this message.","triggerScenarios":"s.PublicKey is non-nil and fi.ResourceAsString(*s.PublicKey) returns an error while Find() diffs the desired vs actual key.","commonSituations":"The SSH public key file path in the cluster spec doesn't exist or isn't readable on the machine running kops, or the resource is malformed.","solutions":["Check the sshPublicKey / public key file path in the cluster spec exists and is readable on the machine running kops","Verify file permissions (e.g. chmod 644) for the key file","Inspect the wrapped inner error for the underlying read failure","Re-run kops update after fixing the key file"],"exampleFix":"// before\nsshPublicKey: file:///home/user/.ssh/id_rsa_missing.pub\n// after\nsshPublicKey: file:///home/user/.ssh/id_rsa.pub","handlingStrategy":"validation","validationCode":"data, err := os.ReadFile(pubKeyPath)\nif err != nil {\n    return fmt.Errorf(\"cannot read public key %s: %w\", pubKeyPath, err)\n}\nif _, _, _, _, err := ssh.ParseAuthorizedKey(data); err != nil {\n    return fmt.Errorf(\"invalid public key: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"actual, err := task.Find(ctx)\nif err != nil {\n    if strings.Contains(err.Error(), \"error rendering SSH key data\") {\n        // fix/re-read the local public key file, then retry\n    }\n    return err\n}","preventionTips":["Verify key file paths in specs exist before running kops","Use absolute paths for sshPublicKey files","Check file readability permissions"],"tags":["linode","akamai","sshkey","resource-rendering"],"backgroundTag":"resource-read-failed","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"}