{"record":{"id":"f0c2399cd0e3c54d","repo":"kubernetes/kops","slug":"parsing-q-certificate-v","errorCode":null,"errorMessage":"parsing %q certificate: %v","messagePattern":"parsing %q certificate: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/server/keystore.go","lineNumber":91,"sourceCode":"// ListKeysets will return all the KeySets.\nfunc (k *keystore) ListKeysets() (map[string]*fi.Keyset, error) {\n\treturn nil, fmt.Errorf(\"server-side client does not support ListKeysets\")\n}\n\nfunc newKeystore(basePath string, cas []string) (*keystore, map[string]string, error) {\n\tkeystore := &keystore{\n\t\tkeys:    map[string]keystoreEntry{},\n\t\tkeySets: map[string]*fi.Keyset{},\n\t}\n\tfor _, name := range cas {\n\t\tcertBytes, err := os.ReadFile(path.Join(basePath, name+\".crt\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"reading %q certificate: %v\", name, err)\n\t\t}\n\t\t// TODO: Support multiple certificates?\n\t\tcertificate, err := pki.ParsePEMCertificate(certBytes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"parsing %q certificate: %v\", name, err)\n\t\t}\n\n\t\tkeyBytes, err := os.ReadFile(path.Join(basePath, name+\".key\"))\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"reading %q key: %v\", name, err)\n\t\t}\n\t\tkey, err := pki.ParsePEMPrivateKey(keyBytes)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"parsing %q key: %v\", name, err)\n\t\t}\n\n\t\tkeystore.keys[name] = keystoreEntry{\n\t\t\tcertificate: certificate,\n\t\t\tkey:         key,\n\t\t}\n\t}\n\n\tvar keypairIDs map[string]string","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/server/keystore.go#L73-L109","documentation":"newKeystore loads each CA's <name>.crt from the CA base path and parses it as a PEM certificate; this error wraps pki.ParsePEMCertificate failing, meaning the file was read but its contents are not a valid PEM certificate.","triggerScenarios":"Thrown at cmd/kops-controller/pkg/server/keystore.go:91 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the certificate file content at the CABasePath for PEM formatting corruption","Regenerate the CA certificate and key pair","Ensure the correct file was placed as <name>.crt"],"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"}