Skip to content
Latchkey

Argo CD auto-sync pruned a resource in CI

With prune: true, auto-sync deletes live resources that are no longer in Git. That is intended, but a wrong source path, a bad targetRevision, or an accidental manifest deletion can cause prune to remove resources you did not mean to drop.

What this error means

A workload disappears after a sync; the app history shows "Pruning" events for resources that vanished from the rendered manifests, often after a path or revision change.

argocd
Syncing (Retrieving ...)
Pruning  Deployment/prod/api
Pruning  Service/prod/api
Sync operation to a1b2c3d succeeded

Common causes

The resource left the rendered manifest set

A wrong path, a broken kustomization, or a deleted file means the resource is no longer generated, so prune removes it as intended.

A targetRevision that points at the wrong tree

Pointing the app at a revision that lacks the resource makes Argo CD believe it should be pruned.

How to fix it

Confirm the render before allowing prune

  1. Run argocd app diff to see exactly what will be pruned.
  2. Verify the source path and targetRevision still include the resource.
  3. Only then sync; restore the resource by fixing the source if it was wrong.
Terminal
argocd app diff my-app
argocd app sync my-app --dry-run

Guard critical resources from prune

Annotate resources you never want pruned so an accidental removal from Git does not delete them.

resource.yaml
metadata:
  annotations:
    argocd.argoproj.io/sync-options: Prune=false

How to prevent it

  • Run argocd app diff in CI before an auto-prune sync.
  • Use Prune=false on resources that must never be auto-deleted.
  • Verify path and targetRevision so prune only drops truly removed resources.

Frequently asked questions

What causes ""auto-sync ... prune" deleting resources"?
A wrong path, a broken kustomization, or a deleted file means the resource is no longer generated, so prune removes it as intended.
How do I fix "auto-sync ... prune" deleting resources?
Confirm the render before allowing prune

Related guides

References

Run this faster and cheaper on Latchkey managed runners - self-healing included. Start free → 30-day trial · No credit card