{"record":{"id":"a98a086c74ab179a","repo":"kubernetes/kops","slug":"error-storing-keyset-w","errorCode":null,"errorMessage":"error storing keyset: %w","messagePattern":"error storing keyset: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops/distrust_keypair.go","lineNumber":186,"sourceCode":"\n\tfor _, id := range keypairIDs {\n\t\tif id == keyset.Primary.Id {\n\t\t\treturn fmt.Errorf(\"cannot distrust the primary keypair\")\n\t\t}\n\t\titem := keyset.Items[id]\n\t\tif item == nil {\n\t\t\treturn fmt.Errorf(\"keypair not found\")\n\t\t}\n\n\t\tif item.DistrustTimestamp != nil {\n\t\t\tcontinue\n\t\t}\n\n\t\tnow := time.Now().UTC().Round(0)\n\t\titem.DistrustTimestamp = &now\n\n\t\tif err := keyStore.StoreKeyset(ctx, name, keyset); err != nil {\n\t\t\treturn fmt.Errorf(\"error storing keyset: %w\", err)\n\t\t}\n\n\t\tfmt.Fprintf(out, \"Distrusted %s %s\\n\", name, id)\n\t}\n\n\treturn nil\n}\n\nfunc completeDistrustKeyset(ctx context.Context, f commandutils.Factory, options *DistrustKeypairOptions, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {\n\tcommandutils.ConfigureKlogForCompletion()\n\n\tcluster, clientSet, completions, directive := GetClusterForCompletion(ctx, f, nil)\n\tif cluster == nil {\n\t\treturn completions, directive\n\t}\n\n\tkeyset, _, completions, directive := completeKeyset(ctx, cluster, clientSet, args, rotatableKeysetFilter)\n\tif keyset == nil {","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops/distrust_keypair.go#L168-L204","documentation":"distrustKeypair persists the modified keyset (with a new DistrustTimestamp) back to the keystore via StoreKeyset; this wraps that write failing - state store permissions, connectivity, or a write conflict after concurrent modification.","triggerScenarios":"Thrown at cmd/kops/distrust_keypair.go:186 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped error for the state store failure reason","Verify write access to the cluster state store","Re-run if the keyset was concurrently modified by another kops operation"],"exampleFix":null,"handlingStrategy":"retry","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"}