Skip to content
Latchkey

Argo CD sync "error validating data" schema failure in CI

During apply, the API server validates each object against its schema. error validating data means a field is unknown, has the wrong type, or is missing a required value, so the resource is rejected before it is created or updated.

What this error means

Sync fails with "error validating data: ValidationError(...)" naming the field, for example an unknown field or a string where an integer is expected.

argocd
error validating data: ValidationError(Deployment.spec.template.spec.containers[0]):
unknown field "port" in io.k8s.api.core.v1.Container; if you choose to ignore these
errors, turn validation off with --validate=false

Common causes

A misspelled or wrong-level field

A key such as port placed where ports belongs, or a field at the wrong nesting level, is not in the schema and fails validation.

A type mismatch

A quoted string where an integer is required (or vice versa) makes the API server reject the value.

How to fix it

Correct the field against the schema

  1. Read the ValidationError path to find the exact field.
  2. Fix the spelling, nesting, or type in the manifest.
  3. Validate against the live schema before re-syncing.
Terminal
kubectl apply --dry-run=server -f deploy.yaml

Validate manifests in CI

Run a schema validator in the pipeline so a bad field fails the build instead of the sync.

.github/workflows/deploy.yml
- run: kubeconform -strict -summary manifests/

How to prevent it

  • Run kubeconform or kubectl apply --dry-run=server in CI before sync.
  • Do not disable validation to force a manifest through.
  • Pin manifest apiVersions to what the target cluster supports.

Frequently asked questions

What causes ""error validating data""?
A key such as port placed where ports belongs, or a field at the wrong nesting level, is not in the schema and fails validation.
How do I fix "error validating data"?
Correct the field against the schema

Related guides

References

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