rancher/rancher · error · apierrors.StatusError

the object has been modified; please apply your changes to t

Error message

the object has been modified; please apply your changes to the latest version and try again

What it means

Error "the object has been modified; please apply your changes to the latest version and try again" thrown in rancher/rancher.

Source

Thrown at pkg/ext/stores/kubeconfig/store.go:1633

	// single-condition upsert was introduced.
	if c := meta.FindStatusCondition(newKubeconfig.Status.Conditions, UpdatedCond); c != nil {
		c.LastTransitionTime = metav1.NewTime(time.Now())
	}

	// Note: [Store.toConfigMap] takes care of enforcing [KindLabel] label and [UIDAnnotation] annotation.
	newConfigMap, err := s.toConfigMap(newKubeconfig)
	if err != nil {
		return nil, false, apierrors.NewInternalError(fmt.Errorf("error converting kubeconfig %s to configmap: %v", name, err))
	}

	dryRun := options != nil && len(options.DryRun) > 0

	// Enforce the client's resourceVersion precondition even on dry-run, so a
	// preview predicts the real conflict outcome.
	if newKubeconfig.ResourceVersion != "" &&
		newKubeconfig.ResourceVersion != oldKubeconfig.ResourceVersion {
		return nil, false, apierrors.NewConflict(gvr.GroupResource(), name,
			errors.New(genericregistry.OptimisticLockErrorMsg))
	}

	if !dryRun {
		newConfigMap, err = s.configMapClient.Update(newConfigMap)
		if err != nil {
			return nil, false, mapBackingError(err, name)
		}
	}

	newKubeconfig, err = s.fromConfigMap(newConfigMap)
	if err != nil {
		return nil, false, apierrors.NewInternalError(fmt.Errorf("error converting configmap %s to kubeconfig: %v", name, err))
	}

	return newKubeconfig, false, nil
}

// GetSingularName implements [rest.SingularNameProvider].

View on GitHub (pinned to 932558d4e6)

When it happens

Trigger: Thrown at pkg/ext/stores/kubeconfig/store.go:1633 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rancher/rancher@932558d4e6 (2026-08-16). Data as JSON: /api/errors/a7e8ddf0822673a2. Report an issue: GitHub.