{"record":{"id":"85458922416946c4","repo":"GoogleContainerTools/skaffold","slug":"failed-to-apply-setter-to-file-s-err-v","errorCode":null,"errorMessage":"failed to apply setter to file %s, err: %v","messagePattern":"failed to apply setter to file (.+?), err: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/render/renderer/kustomize/kustomize.go","lineNumber":339,"sourceCode":"\t}\n\tif err := fs.WriteTo(pFile, bytes); err != nil {\n\t\treturn err\n\t}\n\tfsPath, err := fs.GetPath(pFile)\n\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif kubernetes.IsKubernetesManifest(fsPath) {\n\t\terr = k.transformer.TransformPath(fsPath)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\terr = k.applySetters.ApplyPath(fsPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"failed to apply setter to file %s, err: %v\", pFile, err)\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (k Kustomize) mirrorFiles(kusDir string, fs TmpFS, paths []string) error {\n\tfor _, path := range paths {\n\t\terr := k.mirrorFile(kusDir, fs, path)\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t}\n\treturn nil\n}\n\nfunc (k Kustomize) mirrorBases(kusDir string, fs TmpFS, bases []string) error {\n\tfor _, b := range bases {\n\t\tif err := k.mirror(filepath.Join(kusDir, b), fs); err != nil {","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/render/renderer/kustomize/kustomize.go#L321-L357","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Open the named file and fix YAML/JSON syntax errors (validate with yamllint or kubectl kustomize)","Ensure images/setters values passed via --images or config are well-formed","Check the file is readable and the temp FS is writable (disk space, permissions)","Run kubectl kustomize <dir> locally to reproduce the parse failure"],"exampleFix":"// before (patch.yaml)\napiVersion apps/v1\nkind: Deployment\n// after\napiVersion: apps/v1\nkind: Deployment","handlingStrategy":"validation","validationCode":"files := append(patches, resources...)\nfor _, f := range files {\n    if _, err := yamlparse(strings.Join([]string{read(f)})); err != nil {\n        return fmt.Errorf(\"invalid YAML in %s: %v\", f, err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := k.applySetters.ApplyPath(fsPath); err != nil {\n    // surface which file failed and validate it standalone\n    return fmt.Errorf(\"setter failed on %s: %w\", pFile, err)\n}","preventionTips":["Lint all patch/resource/generator YAML files in CI (yamllint)","Test `kubectl kustomize` on the full tree before skaffold render","Keep image/setter target files valid YAML with a trailing newline"],"tags":["kustomize","yaml","setters","skaffold"],"backgroundTag":"yaml-parse-failed","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}