Operation cannot be fulfilled on deployments.apps "x": the object has been modified; please apply your changes to the latest version and try again
Optimistic-concurrency conflict: the object changed (new resourceVersion) between when you read it and when you tried to update it.
Seen on:
Kubernetes
Meaning
Controllers, HPAs and humans all update objects; each update must carry the latest resourceVersion. kubectl edit/replace with stale copies and operators without retry logic hit this. It’s usually transient — retry with a fresh read.
Common causes
- Another controller updated the object at the same time (HPA, operator)
- kubectl replace/edit with an old copy
- Custom controller not retrying on conflict
⚡ Quick fix
- Re-run the command (it reads the latest version)
- Use kubectl apply or patch instead of replace
- In controllers, use retry.RetryOnConflict
Detailed fix by platform
Go
- bash
err := retry.RetryOnConflict(retry.DefaultRetry, func() error { d, _ := client.AppsV1().Deployments(ns).Get(ctx, name, metav1.GetOptions{}) d.Spec.Replicas = &n _, err := client.AppsV1().Deployments(ns).Update(ctx, d, metav1.UpdateOptions{}) return err })
How to diagnose
- Writers — Who else updates the object?
- Command — replace vs apply/patch
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Most viewed in Kubernetes
- error converting YAML to JSON error converting YAML to JSON: yaml: line 12: did not find expected key
- is waiting to start Error from server (BadRequest): container "x" in pod "y" is waiting to start: ContainerCreating
- kubectl connection refused kubectl: The connection to the server localhost:8080 was refused — did you specify the right host or port?
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026