GoogleContainerTools/skaffold · error
unable to parse path %q: %w
Error message
unable to parse path %q: %w
What it means
Skaffold's kustomize renderer expands each configured kustomize path as an environment-variable Go template via ExpandEnvTemplate before rendering. If the template is malformed (bad syntax, unknown field, missing env key in strict mode), expansion fails and this error wraps the underlying cause. The original path is quoted to identify the offending entry.
Source
Thrown at pkg/skaffold/render/renderer/kustomize/kustomize.go:77
manifestOverrides map[string]string
applySetters applysetters.ApplySetters
transformer transform.Transformer
validator validate.Validator
transformAllowlist map[apimachinery.GroupKind]latest.ResourceFilter
transformDenylist map[apimachinery.GroupKind]latest.ResourceFilter
}
func (k Kustomize) Render(ctx context.Context, out io.Writer, builds []graph.Artifact, offline bool) (manifest.ManifestListByConfig, error) {
var manifests manifest.ManifestList
kCLI := kubectl.NewCLI(k.cfg, "")
useKubectlKustomize := !generate.KustomizeBinaryCheck() && generate.KubectlVersionCheck(kCLI)
var kustomizePaths []string
for _, kustomizePath := range k.rCfg.Kustomize.Paths {
kPath, err := sUtil.ExpandEnvTemplate(kustomizePath, nil)
if err != nil {
return manifest.ManifestListByConfig{}, fmt.Errorf("unable to parse path %q: %w", kustomizePath, err)
}
kustomizePaths = append(kustomizePaths, kPath)
}
for _, kustomizePath := range kustomizePaths {
if !sUtil.IsURL(kustomizePath) && !filepath.IsAbs(kustomizePath) {
kustomizePath = filepath.Join(k.cfg.GetWorkingDir(), kustomizePath)
}
out, err := k.render(ctx, kustomizePath, useKubectlKustomize, kCLI)
if err != nil {
return manifest.ManifestListByConfig{}, err
}
if len(out) == 0 {
continue
}
manifests.Append(out)
}
View on GitHub (pinned to a1189de023)
Solutions
- Set the referenced environment variable (e.g. export FOO=... ) before running skaffold
- Remove or correct the template expression in the kustomize path in skaffold.yaml
- If the path should be literal, escape or drop the {{ }} braces
- Run with debug logging to see the wrapped inner error for the exact template failure
Example fix
// before (skaffold.yaml)
render:
kustomize:
paths:
- '{{ .UNSET_ENV }}/overlays/prod'
// after
render:
kustomize:
paths:
- './overlays/prod' Defensive patterns
Strategy: validation
Validate before calling
for _, p := range kustomizePaths {
if _, err := os.ExpandEnv(p); p != os.ExpandEnv(p) {
// template present: ensure referenced vars are set
}
if strings.Contains(p, "{{") {
// verify template vars exist before calling skaffold
t := template.Must(template.New("p").Parse(p))
_ = t.Execute(io.Discard, envMap) // surfaces missing keys early
}
} Type guard
func isWellFormedTemplatePath(p string, env map[string]string) bool {
if !strings.Contains(p, "{{") { return true }
t, err := template.New("p").Parse(p)
if err != nil { return false }
return t.Execute(io.Discard, env) == nil
} Prevention
- Avoid {{ }} templates in kustomize paths unless the env var is guaranteed to be set
- Prefer static relative paths and use kustomize overlays for environment variation
- Validate skaffold.yaml paths in CI before render
When it happens
Trigger: Calling Render with k.rCfg.Kustomize.Paths containing a string like `{{ .FOO }}` or `${MISSING_VAR}` that ExpandEnvTemplate cannot resolve; a path containing stray `{{` characters; a template referencing an undefined env var.
Common situations: Developer uses skaffold template syntax not supported by ExpandEnvTemplate (e.g. sprig functions), forgets to export an env var referenced in the kustomize path, or typos `{{` in a path containing literal braces.
Understand the failure class
- Parsing and encoding errors: unexpected token, malformed input — why parsers reject input and how to find the real culprit.
Related errors
- unable to lookup minikube executable. Please add it to PATH
- rendering manifests: %w
- setting template flag: %w
- normalizing dockerfile path: %w
- unable to parse path %q: %w
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/0247f6a7f932e863.
Report an issue: GitHub.