{"record":{"id":"0caac451f26754f7","repo":"kubernetes/kops","slug":"error-reading-q-w","errorCode":null,"errorMessage":"error reading %q: %w","messagePattern":"error reading %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bootstrap/pkibootstrap/pkisigner.go","lineNumber":94,"sourceCode":"\t\treturn \"\", fmt.Errorf(\"error converting public key to x509: %w\", err)\n\t}\n\n\tvar b bytes.Buffer\n\tif err := pem.Encode(&b, &pem.Block{Type: \"PUBLIC KEY\", Bytes: pkData}); err != nil {\n\t\treturn \"\", fmt.Errorf(\"error encoding public key: %w\", err)\n\t}\n\treturn b.String(), nil\n}\n\nfunc NewAuthenticatorFromFile(p string) (bootstrap.Authenticator, error) {\n\thostname, err := os.Hostname()\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"couldn't determine hostname: %w\", err)\n\t}\n\n\tkeyBytes, err := os.ReadFile(p)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error reading %q: %w\", p, err)\n\t}\n\tkey, err := pki.ParsePEMPrivateKey(keyBytes)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing key from %q: %w\", p, err)\n\t}\n\n\treturn NewAuthenticator(hostname, key.Key)\n}\n\nfunc (a *pkiAuthenticator) CreateToken(body []byte) (string, error) {\n\trequestHash := sha256.Sum256(body)\n\n\tdata := AuthTokenData{\n\t\tTimestamp:   time.Now().Unix(),\n\t\tAudience:    AudienceNodeAuthentication,\n\t\tRequestHash: requestHash[:],\n\n\t\tKeyID:    a.keyID,","sourceCodeStart":76,"sourceCodeEnd":112,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/bootstrap/pkibootstrap/pkisigner.go#L76-L112","documentation":"Reading the private key file for NewAuthenticatorFromFile failed at the OS level (missing file, permissions, or I/O error); %q is the path passed to the authenticator constructor, before any parsing is attempted.","triggerScenarios":"Thrown at pkg/bootstrap/pkibootstrap/pkisigner.go:94 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the key file path exists and is readable by the process (check mode/ownership)","Correct the path given to the authenticator/keyset configuration","Restore the key file from the state store or reissue the keypair if corrupted"],"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"}