A PreSync hook fails with `jobs.batch "db-migrate" already exists`.
BeginnerTroubleshootingSync Operations, Hooks & Health
Answer
Likely causes → The previous run's Job was not deleted, because the hook has no hook-delete-policy or uses HookSucceeded and the last run failed.
Diagnose → kubectl -n web get job db-migrate -o yaml | yq '.metadata.annotations'.
Fix → Delete the old Job and set:
annotations:
argocd.argoproj.io/hook: PreSync
argocd.argoproj.io/hook-delete-policy: BeforeHookCreation
Or use generateName so every run gets a new Job.
Prevent → BeforeHookCreation as the default policy for all hook Jobs; it keeps the last failed Job for debugging.
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.Intermediate`one or more objects failed to apply, reason: Deployment.apps "web" is invalid: spec.selector: Invalid value: ...: field is immutable`.BeginnerSync 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 PostSync smoke-test hook never runs, even though the sync says succeeded.IntermediateAn Ingress stays `Progressing` forever, holding the app at Progressing.Intermediate