{"record":{"id":"9aa60382ef82c9b5","repo":"kubernetes/kops","slug":"parsing-keypair-ids-yaml","errorCode":null,"errorMessage":"parsing keypair-ids.yaml","messagePattern":"parsing keypair-ids\\.yaml","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/server/keystore.go","lineNumber":115,"sourceCode":"\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\n\tfor name, keypairID := range keypairIDs {\n\t\tentry, found := keystore.keys[name]\n\t\tif !found {\n\t\t\t// keypair-ids.yaml also includes CAs this server is not configured to serve (e.g. the etcd CAs).\n\t\t\tklog.V(2).Infof(\"keypair %q found in keypair IDs, not loaded as a served CA\", name)\n\t\t\tcontinue\n\t\t}\n\t\tprimary := &fi.KeysetItem{}\n\t\tprimary.Id = keypairID\n\t\tprimary.Certificate = entry.certificate\n\t\tprimary.PrivateKey = entry.key\n\n\t\tkeyset := &fi.Keyset{}\n\t\tkeyset.Primary = primary\n\t\tkeyset.Items = make(map[string]*fi.KeysetItem)","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/server/keystore.go#L97-L133","documentation":"newKeystore unmarshals the previously read keypair-ids.yaml bytes into a map; this fires when the YAML is syntactically invalid or does not match map[string]string. The file exists and is readable, but its content is malformed.","triggerScenarios":"Thrown at cmd/kops-controller/pkg/server/keystore.go:115 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the YAML syntax in keypair-ids.yaml","Ensure the file is a flat mapping of keyset name to keypair ID string"],"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"}