kubernetes/kops · error

error applying update after prune

Error message

error applying update after prune: %w

What it means

updateAddon retries the apply after a successful prune when the first apply failed but pruning succeeded; this error means the second apply attempt also failed. Both the original apply error and this retry error are accumulated via multierr.

Solutions

  1. Inspect the wrapped error from the retried apply
  2. Check whether pruning removed an object the manifest apply depends on and re-run
  3. Verify cluster health and RBAC permissions, then re-run the channel apply
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at channels/pkg/channels/addon.go:214 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/2691f65008ac8051. Report an issue: GitHub.

Appendix: source

Thrown at channels/pkg/channels/addon.go:214

	if err != nil {
		return fmt.Errorf("error reading manifest: %w", err)
	}

	var merr error
	var applyError, pruneError error

	if applyError = applier.Apply(ctx, data); applyError != nil {
		merr = multierr.Append(merr, fmt.Errorf("error applying update: %w", applyError))
	}

	if pruneError = pruner.Prune(ctx, data, a.Spec.Prune); pruneError != nil {
		merr = multierr.Append(merr, fmt.Errorf("error pruning manifest: %w", pruneError))
	}

	if applyError != nil && pruneError == nil {
		// If we failed to apply, but not prune, we should try to apply again
		if err := applier.Apply(ctx, data); err != nil {
			merr = multierr.Append(merr, fmt.Errorf("error applying update after prune: %w", err))
		} else {
			// If we succeeded to apply after prune, clear the errors
			merr = nil
		}
	}

	if merr != nil {
		return fmt.Errorf("error updating addon from %q: %w", manifestURL, merr)
	}

	if err := a.AddNeedsUpdateLabel(ctx, k8sClient, required); err != nil {
		return fmt.Errorf("error adding needs-update label: %v", err)
	}

	channel := a.buildChannel()
	err = channel.SetInstalledVersion(ctx, k8sClient, a.ChannelVersion())
	if err != nil {
		return fmt.Errorf("error applying annotation to record addon installation: %v", err)

View on GitHub (pinned to 4c8573c808)