GoogleContainerTools/skaffold · error
evaluating custom template component: %w
Error message
evaluating custom template component: %w
What it means
One of the component taggers failed while generating its tag string during custom template evaluation. After all taggers are collected, `EvaluateComponents` calls each tagger's `GenerateTag(ctx, image)`; any failure is wrapped with this message naming none of them directly but wrapping the underlying cause. The template is never executed.
Source
Thrown at pkg/skaffold/tag/custom_template.go:101
gitTagger, _ := NewGitCommit("", "", false)
taggers[field] = gitTagger
case "DATE":
taggers[field] = NewDateTimeTagger("", "")
case "SHA":
taggers[field] = &ChecksumTagger{}
case "INPUT_DIGEST":
inputDigestTagger, _ := NewInputDigestTagger(t.RunCtx, graph.ToArtifactGraph(t.RunCtx.Artifacts()))
taggers[field] = inputDigestTagger
default:
return nil, fmt.Errorf("no tagger available for component %+v", field)
}
}
customMap := map[string]string{}
for k, v := range taggers {
tag, err := v.GenerateTag(ctx, image)
if err != nil {
return nil, fmt.Errorf("evaluating custom template component: %w", err)
}
customMap[k] = tag
}
return customMap, nil
}
// ParseCustomTemplate is a simple wrapper to parse an custom template.
func ParseCustomTemplate(t string) (*template.Template, error) {
return template.New("customTemplate").Parse(t)
}
// ExecuteCustomTemplate executes a customTemplate against a custom map.
func ExecuteCustomTemplate(customTemplate *template.Template, customMap map[string]string) (string, error) {
var buf bytes.Buffer
log.Entry(context.TODO()).Debugf("Executing custom template %v with custom map %v", customTemplate, customMap)
if err := customTemplate.Execute(&buf, customMap); err != nil {
return "", fmt.Errorf("executing template: %w", err)
}View on GitHub (pinned to a1189de023)
Solutions
- Read the wrapped cause to identify which component failed and why
- For GIT component: ensure the workspace is a git repo with at least one commit (git init && git commit)
- For DIGEST/SHA components: ensure the image was built/pushed before tagging
- Verify git is installed and accessible on PATH
Example fix
// before: not a git repo, GIT tagger fails skaffold dev // after git init && git add -A && git commit -m init skaffold dev
Defensive patterns
Strategy: try-catch
Validate before calling
// pre-check environment for GIT component
if fieldsContain(tmpl, "GIT") {
if _, err := exec.LookPath("git"); err != nil {
return errors.New("git not on PATH; required by GIT tag component")
}
if _, err := git.ExecCommand(ctx, nil, "rev-parse", "HEAD"); err != nil {
return errors.New("not a git repository with commits")
}
} Try / catch
customMap, err := tag.EvaluateComponents(ctx, t, image)
if err != nil {
var cause error
if errors.As(err, &cause) {
log.Errorf("component failed: %v", cause) // e.g. git describe error
}
return fmt.Errorf("ensure git repo exists and image is built: %w", err)
} Prevention
- git init + initial commit before skaffold dev in new projects
- Install git in CI images
- Build/push images before tags depending on DIGEST/SHA
- Avoid shallow clones when tags are needed
When it happens
Trigger: During `GenerateTag`, a component tagger (e.g. GIT, SHA, DIGEST) errors — e.g. `git describe` fails because the workspace is not a git repo, or digest computation fails because the image isn't available.
Common situations: GIT component used outside a git repository or with no commits; SHA/digest tagger used before the image is built/pushed; git binary missing in the environment; shallow clone without tags.
Related errors
- getting tags: %w
- parsing template: %w
- no tagger available for component %+v
- executing template: %w
- %q is not a valid git tagger variant
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/fe1b3f7add827ea9.
Report an issue: GitHub.