GoogleContainerTools/skaffold · error
packaged.appVersion template: %w
Error message
packaged.appVersion template: %w
What it means
Wraps util.ExpandEnvTemplate failure when expanding releases[].packaged.appVersion during chart packaging. Same template mechanics as packaged.version but applied to the appVersion flag passed to `helm package`.
Source
Thrown at pkg/skaffold/deploy/helm/helm.go:690
return "", fmt.Errorf("tempdir: %w", err)
}
tmpDir = t
}
args := []string{"package", r.ChartPath, "--destination", tmpDir}
if r.Packaged.Version != "" {
v, err := util.ExpandEnvTemplate(r.Packaged.Version, nil)
if err != nil {
return "", fmt.Errorf("packaged.version template: %w", err)
}
args = append(args, "--version", v)
}
if r.Packaged.AppVersion != "" {
av, err := util.ExpandEnvTemplate(r.Packaged.AppVersion, nil)
if err != nil {
return "", fmt.Errorf("packaged.appVersion template: %w", err)
}
args = append(args, "--app-version", av)
}
buf := &bytes.Buffer{}
if err := helm.Exec(ctx, h, buf, false, nil, args...); err != nil {
return "", fmt.Errorf("package chart into a .tgz archive: %v: %w", args, err)
}
output := strings.TrimSpace(buf.String())
idx := strings.Index(output, tmpDir)
if idx == -1 {
return "", fmt.Errorf("unable to find %s in output: %s", tmpDir, output)
}
return output[idx:], nilView on GitHub (pinned to a1189de023)
Solutions
- Export the referenced env variable
- Use a literal appVersion string
- Keep appVersion and version templates consistent so one export covers both
Example fix
// before
packaged:
appVersion: "{{.APP_REV}}"
// after
export APP_REV=42
skaffold run Defensive patterns
Strategy: validation
Validate before calling
tpl := release.Packaged.AppVersion
if strings.Contains(tpl, "{{") {
if _, err := texttemplate.New("t").Parse(tpl); err != nil { return err }
for _, m := range varRegex.FindAllStringSubmatch(tpl, -1) {
if os.Getenv(m[1]) == "" { return fmt.Errorf("env %s unset", m[1]) }
}
} Prevention
- Export appVersion variables alongside version variables
- Use literal strings where possible
- Lint skaffold.yaml templates in CI
When it happens
Trigger: Calling Deploy with packaged.appVersion containing {{.VAR}} for an unset variable or malformed template syntax.
Common situations: Same as packaged.version: missing CI env vars, syntax typos, stray characters in the app version.
Related errors
- cannot parse the release name template: %w
- packaged.version template: %w
- collecting helm releases namespaces: %w
- cannot parse the release namespace template: %w
- strings.Join(errMsgs, "\n") (joined helm cleanup error messa
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/6e44e74fd74bf5a4.
Report an issue: GitHub.