GoogleContainerTools/skaffold · error
packaged.version template: %w
Error message
packaged.version template: %w
What it means
Wraps util.ExpandEnvTemplate failure when expanding releases[].packaged.version during chart packaging. The version string is treated as a template; invalid syntax or unset env vars abort packaging before helm package runs.
Source
Thrown at pkg/skaffold/deploy/helm/helm.go:682
// packageChart packages the chart and returns the path to the resulting chart archive
func (h *Deployer) packageChart(ctx context.Context, r latest.HelmRelease) (string, error) {
// Allow a test to sneak a predictable path in
tmpDir := h.pkgTmpDir
if tmpDir == "" {
t, err := os.MkdirTemp("", "skaffold-helm")
if err != nil {
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)
}
View on GitHub (pinned to a1189de023)
Solutions
- Export the env var used in packaged.version before running skaffold
- Replace the template with a literal version (e.g. "1.2.3") if no templating is needed
- Verify the template renders: `echo "{{.VERSION}}" | envsubst` mentally / test with skaffold render
Example fix
// before
packaged:
version: "{{.GIT_TAG}}"
// after
export GIT_TAG=v1.2.3
skaffold run Defensive patterns
Strategy: validation
Validate before calling
tpl := release.Packaged.Version
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 version variables in CI before deploy
- Use literal versions when templating is unnecessary
- Validate semver output of expanded templates
When it happens
Trigger: Calling Deploy with packaged.version like {{.VERSION}} where VERSION is unset, or containing invalid Go template syntax (e.g. unbalanced braces).
Common situations: CI pipelines that forgot to export the version variable; semver tags inserted with stray characters; copy-paste of {{ }} templates into static values.
Related errors
- cannot parse the release name template: %w
- packaged.appVersion 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/28f62f2b02f0819c.
Report an issue: GitHub.