kubernetes/kops · error

error storing keyset: %w

Error message

error storing keyset: %w

What it means

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.

Source

Thrown at cmd/kops/distrust_keypair.go:186

	for _, id := range keypairIDs {
		if id == keyset.Primary.Id {
			return fmt.Errorf("cannot distrust the primary keypair")
		}
		item := keyset.Items[id]
		if item == nil {
			return fmt.Errorf("keypair not found")
		}

		if item.DistrustTimestamp != nil {
			continue
		}

		now := time.Now().UTC().Round(0)
		item.DistrustTimestamp = &now

		if err := keyStore.StoreKeyset(ctx, name, keyset); err != nil {
			return fmt.Errorf("error storing keyset: %w", err)
		}

		fmt.Fprintf(out, "Distrusted %s %s\n", name, id)
	}

	return nil
}

func completeDistrustKeyset(ctx context.Context, f commandutils.Factory, options *DistrustKeypairOptions, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
	commandutils.ConfigureKlogForCompletion()

	cluster, clientSet, completions, directive := GetClusterForCompletion(ctx, f, nil)
	if cluster == nil {
		return completions, directive
	}

	keyset, _, completions, directive := completeKeyset(ctx, cluster, clientSet, args, rotatableKeysetFilter)
	if keyset == nil {

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the wrapped error for the state store failure reason
  2. Verify write access to the cluster state store
  3. Re-run if the keyset was concurrently modified by another kops operation
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cmd/kops/distrust_keypair.go:186 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/a98a086c74ab179a. Report an issue: GitHub.