{"record":{"id":"2ccb79c84501d31c","repo":"GoogleContainerTools/skaffold","slug":"cannot-locate-kustomization-file-from-provided-dir","errorCode":null,"errorMessage":"cannot locate kustomization file from provided directory: %s","messagePattern":"cannot locate kustomization file from provided directory: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/render/renderer/kustomize/kustomize.go","lineNumber":156,"sourceCode":"\n\tif useKubectlKustomize {\n\t\treturn kCLI.Kustomize(ctx, kustomizeBuildArgs(k.rCfg.Kustomize.BuildArgs, kustomizePath))\n\t} else {\n\t\tcmd := exec.CommandContext(ctx, \"kustomize\", append([]string{\"build\"}, kustomizeBuildArgs(k.rCfg.Kustomize.BuildArgs, kustomizePath)...)...)\n\t\treturn sUtil.RunCmdOut(ctx, cmd)\n\t}\n}\n\nfunc getKustomizationFile(kusDir string) (string, error) {\n\tfor _, path := range constants.KustomizeFilePaths {\n\t\tkPath := filepath.Join(kusDir, path)\n\t\t_, err := os.Stat(kPath)\n\t\tif err != nil {\n\t\t\tcontinue\n\t\t}\n\t\treturn kPath, nil\n\t}\n\treturn \"\", fmt.Errorf(\"cannot locate kustomization file from provided directory: %s\", kusDir)\n}\n\nfunc (k Kustomize) mirror(kusDir string, fs TmpFS) error {\n\tkFile, err := getKustomizationFile(kusDir)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tbytes, err := os.ReadFile(kFile)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif err := fs.WriteTo(kFile, bytes); err != nil {\n\t\treturn err\n\t}\n\n\tkustomization := types.Kustomization{}","sourceCodeStart":138,"sourceCodeEnd":174,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/render/renderer/kustomize/kustomize.go#L138-L174","documentation":"getKustomizationFile probes a set of well-known kustomization filenames (kustomization.yaml, kustomization.yml, Kustomization) with os.Stat in the given directory; if none exist it returns this error. It surfaces when mirroring the kustomize root into a temp filesystem before rendering.","triggerScenarios":"Render/mirror invoked with k.rCfg.Kustomize.Paths pointing to a directory that contains no kustomization.yaml/yml/Kustomization file; path points to the wrong directory or file was deleted.","commonSituations":"Pointing skaffold.yaml at an overlays parent dir instead of the overlay dir; kustomization.yaml not committed / wrong filename casing (KUSTOMIZATION.YAML); path expanded to a directory that only contains resources.","solutions":["Verify the configured path points at a directory containing kustomization.yaml, kustomization.yml, or Kustomization","Create or rename the kustomization file with the exact expected casing","Check the expanded path (env templates) resolves to the intended directory","If referencing a remote base, use a URL/path whose root still has a kustomization file"],"exampleFix":"// before\nls overlays/prod/    # only deployment.yaml, no kustomization.yaml\n// after\n# add overlays/prod/kustomization.yaml:\napiVersion: kustomize.config.k8s.io/v1beta1\nkind: Kustomization\nresources:\n  - deployment.yaml","handlingStrategy":"validation","validationCode":"for _, name := range []string{\"kustomization.yaml\",\"kustomization.yml\",\"Kustomization\"} {\n    if fi, err := os.Stat(filepath.Join(kusDir, name)); err == nil && !fi.IsDir() {\n        return nil // found\n    }\n}\nreturn fmt.Errorf(\"no kustomization file in %s\", kusDir)","typeGuard":null,"tryCatchPattern":"if _, err := getKustomizationFile(dir); err != nil {\n    return fmt.Errorf(\"skaffold render precondition failed for %s: %w\", dir, err)\n}","preventionTips":["Always run kubectl kustomize <dir> locally before wiring a path into skaffold.yaml","Commit kustomization.yaml files and check filename casing (Linux is case-sensitive)","Point paths at the directory containing the kustomization file, not its parent"],"tags":["kustomize","file-not-found","skaffold"],"backgroundTag":"kustomization-file-not-found","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"}