GoogleContainerTools/skaffold · error

%s is not a valid Kubernetes manifest

Error message

%s is not a valid Kubernetes manifest

What it means

validateManifests, invoked by doApply in `skaffold apply`, parses each manifest file supplied on the command line with kubernetes.ParseKubernetesObjects. If parsing or object validation fails for a file, the error is wrapped as "<file> is not a valid Kubernetes manifest" so the user knows exactly which file is rejected.

Source

Thrown at cmd/skaffold/app/cmd/apply.go:79

	if err := validateManifests(args); err != nil {
		return err
	}
	return withRunner(ctx, out, func(r runner.Runner, configs []util.VersionedConfig) error {
		return r.Apply(ctx, out)
	})
}

func validateManifests(manifests []string) error {
	for _, m := range manifests {
		if _, err := os.Open(m); err != nil {
			if errors.Is(err, os.ErrNotExist) {
				return fmt.Errorf("cannot find provided file %s", m)
			}
			return fmt.Errorf("unable to open provided file %s", m)
		}

		if _, err := kubernetes.ParseKubernetesObjects(m); err != nil {
			return errors.Wrap(err, fmt.Sprintf("%s is not a valid Kubernetes manifest", m))
		}
	}
	return nil
}

View on GitHub (pinned to a1189de023)

Solutions

  1. Open the named file and run `kubectl apply --dry-run=client -f <file>` to reproduce and see the parser's detailed error.
  2. Remove non-Kubernetes files from the -m list; only pass actual resource manifests.
  3. Render templates before applying (e.g. helm template / envsubst) so no unresolved placeholders reach skaffold apply.
  4. Fix apiVersion/kind typos or invalid YAML syntax (tabs, bad indentation) reported by the parser.
  5. If the file intentionally holds no objects, drop it or empty it from the apply arguments.

Example fix

// before (shell)
skaffold apply -m manifest.tmpl
// after
envsubst < manifest.tmpl > manifest.yaml
skaffold apply -m manifest.yaml
Defensive patterns

Strategy: validation

Validate before calling

# validate every -m file before running skaffold apply
for f in $MANIFESTS; do
  kubectl apply --dry-run=client -f "$f" > /dev/null || { echo "invalid: $f"; exit 1; }
done

Prevention

When it happens

Trigger: Running `skaffold apply -m file.yaml` where the file fails ParseKubernetesObjects: it is not YAML/JSON, contains no Kubernetes objects, has an unknown apiVersion/kind, or contains YAML that decodes to a non-object (e.g. a List of strings or plain text).

Common situations: Pointing -m at a docker-compose file, Helm values file, kustomization.yaml, or a template file with unresolved {{ }} placeholders; passing a multi-doc file where one doc is invalid; typos in apiVersion/kind; YAML with tabs or encoding issues.

Related errors


AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05). Data as JSON: /api/errors/1841cb8dccc0ed0c. Report an issue: GitHub.