GoogleContainerTools/skaffold · error

failed to apply setter to file %s, err: %v

Error message

failed to apply setter to file %s, err: %v

What it means

After mirroring patch/resource/generator files into the temp FS, the renderer runs applySetters.ApplyPath on each file to inject image/settable values. If that mutation fails (parse error or write error on the mirrored file), the failure is wrapped with the originating file name. This aborts the render for the affected file.

Source

Thrown at pkg/skaffold/render/renderer/kustomize/kustomize.go:339

	}
	if err := fs.WriteTo(pFile, bytes); err != nil {
		return err
	}
	fsPath, err := fs.GetPath(pFile)

	if err != nil {
		return err
	}

	if kubernetes.IsKubernetesManifest(fsPath) {
		err = k.transformer.TransformPath(fsPath)
		if err != nil {
			return err
		}

		err = k.applySetters.ApplyPath(fsPath)
		if err != nil {
			return fmt.Errorf("failed to apply setter to file %s, err: %v", pFile, err)
		}
	}
	return nil
}

func (k Kustomize) mirrorFiles(kusDir string, fs TmpFS, paths []string) error {
	for _, path := range paths {
		err := k.mirrorFile(kusDir, fs, path)
		if err != nil {
			return err
		}
	}
	return nil
}

func (k Kustomize) mirrorBases(kusDir string, fs TmpFS, bases []string) error {
	for _, b := range bases {
		if err := k.mirror(filepath.Join(kusDir, b), fs); err != nil {

View on GitHub (pinned to a1189de023)

Solutions

  1. Open the named file and fix YAML/JSON syntax errors (validate with yamllint or kubectl kustomize)
  2. Ensure images/setters values passed via --images or config are well-formed
  3. Check the file is readable and the temp FS is writable (disk space, permissions)
  4. Run kubectl kustomize <dir> locally to reproduce the parse failure

Example fix

// before (patch.yaml)
apiVersion apps/v1
kind: Deployment
// after
apiVersion: apps/v1
kind: Deployment
Defensive patterns

Strategy: validation

Validate before calling

files := append(patches, resources...)
for _, f := range files {
    if _, err := yamlparse(strings.Join([]string{read(f)})); err != nil {
        return fmt.Errorf("invalid YAML in %s: %v", f, err)
    }
}

Try / catch

if err := k.applySetters.ApplyPath(fsPath); err != nil {
    // surface which file failed and validate it standalone
    return fmt.Errorf("setter failed on %s: %w", pFile, err)
}

Prevention

When it happens

Trigger: mirrorPatchesStrategicMerge / mirrorResources / mirrorFiles / mirrorPatches / mirrorSecretGenerators / mirrorConfigMapGenerators process a file that kustomize-style setters cannot parse (invalid YAML/JSON) or cannot be written in the temp dir.

Common situations: A referenced patch file contains malformed YAML; a generator file (e.g. secrets/env file) has a syntax problem; newImage/setters config references a file that is not valid YAML.

Related errors


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