`one or more objects failed to apply, reason: Deployment.apps "web" is invalid: spec.selector: Invalid value: ...: field is immutable`.
BeginnerTroubleshootingSync Operations, Hooks & Health
Answer
Likely causes → Someone changed labels used in spec.selector (often via a chart upgrade or a new commonLabels in Kustomize). Selectors and some fields (Job spec.template, Service clusterIP) cannot be updated in place.
Diagnose → argocd app diff web shows the selector change.
Fix → Revert the selector change, or let Argo CD recreate just that resource: annotate it with argocd.argoproj.io/sync-options: Replace=true (or Force=true,Replace=true) for one sync. Expect a brief outage for that Deployment.
Prevent → Use labels with includeSelectors: false in Kustomize instead of commonLabels; review chart upgrades for selector changes.
More on Sync Operations, Hooks & Health
Sync fails with `one or more synchronization tasks are not valid` and `the server could not find the requested resource` for a custom resource.IntermediateSync of a large CRD fails with `metadata.annotations: Too long: must have at most 262144 bytes`.BeginnerAn app has been stuck at `Syncing` for an hour with `waiting for completion of hook batch/Job/db-migrate`.IntermediateA PreSync hook fails with `jobs.batch "db-migrate" already exists`.BeginnerA PostSync smoke-test hook never runs, even though the sync says succeeded.IntermediateAn Ingress stays `Progressing` forever, holding the app at Progressing.Intermediate