{"record":{"id":"f67ac5a03b57518f","repo":"kubernetes/kops","slug":"parsing-q-key-v","errorCode":null,"errorMessage":"parsing %q key: %v","messagePattern":"parsing %q key: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/server/keystore.go","lineNumber":100,"sourceCode":"\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\n\tkeypairIDsBytes, err := os.ReadFile(path.Join(basePath, \"keypair-ids.yaml\"))\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"reading keypair-ids.yaml\")\n\t}\n\tif err := yaml.Unmarshal(keypairIDsBytes, &keypairIDs); err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"parsing keypair-ids.yaml\")\n\t}\n\n\t// Build keysets","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/server/keystore.go#L82-L118","documentation":"newKeystore parses the previously read <name>.key bytes as a PEM private key; this wraps pki.ParsePEMPrivateKey failing, meaning the key file exists but does not contain a valid PEM private key (wrong format, corrupted, or a cert in its place).","triggerScenarios":"Thrown at cmd/kops-controller/pkg/server/keystore.go:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the .key file actually contains a PEM private key","Regenerate the CA keypair if the key is corrupted","Ensure the correct file was placed as <name>.key"],"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"}