{"record":{"id":"e0e0caf63c1087d8","repo":"kubernetes/kops","slug":"distrusting-keypair-for-s-v","errorCode":null,"errorMessage":"distrusting keypair for %s: %v","messagePattern":"distrusting keypair for (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/distrust_keypair.go","lineNumber":139,"sourceCode":"\n\tkeyStore, err := clientset.KeyStore(cluster)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif options.Keyset != \"all\" {\n\t\treturn distrustKeypair(ctx, out, options.Keyset, options.KeypairIDs, keyStore)\n\t}\n\n\tkeysets, err := keyStore.ListKeysets()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"listing keysets: %v\", err)\n\t}\n\n\tfor name := range keysets {\n\t\tif rotatableKeysetFilter(name, nil) {\n\t\t\tif err := distrustKeypair(ctx, out, name, nil, keyStore); err != nil {\n\t\t\t\treturn fmt.Errorf(\"distrusting keypair for %s: %v\", name, err)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn nil\n}\n\nfunc distrustKeypair(ctx context.Context, out io.Writer, name string, keypairIDs []string, keyStore fi.CAStore) error {\n\tkeyset, err := keyStore.FindKeyset(ctx, name)\n\tif err != nil {\n\t\treturn err\n\t} else if keyset == nil {\n\t\treturn fmt.Errorf(\"keyset not found\")\n\t}\n\n\tif len(keypairIDs) == 0 {\n\t\tprimarySerial := keyset.Primary.Certificate.Certificate.SerialNumber\n\t\tfor id, item := range keyset.Items {","sourceCodeStart":121,"sourceCodeEnd":157,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/distrust_keypair.go#L121-L157","documentation":"While iterating keysets for 'all' mode, RunDistrustKeypair wraps a per-keyset distrustKeypair failure with the keyset name. The underlying failure (find, store, or validation of that keyset) is in the wrapped error.","triggerScenarios":"Thrown at cmd/kops/distrust_keypair.go:139 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error to see which step failed for the named keyset","Fix the keyset-specific issue (e.g. primary-keypair constraint or store error)","Re-run targeting only the failing keyset by name"],"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-12T12:17:11.808Z"}