GoogleContainerTools/skaffold · error
creating tagger: %w
Error message
creating tagger: %w
What it means
`NewForConfig` builds the runner and first constructs a tagger mux from the skaffold.yaml `build.tagPolicy` for every pipeline. This error wraps any failure while instantiating that tagger — e.g. an invalid envTemplate, a git tagger that can't resolve the repo, or malformed customTemplate components.
Source
Thrown at pkg/skaffold/runner/new.go:56
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/tag"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/test"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/trigger"
"github.com/GoogleContainerTools/skaffold/v2/pkg/skaffold/verify"
)
// NewForConfig returns a new SkaffoldRunner for a SkaffoldConfig
func NewForConfig(ctx context.Context, runCtx *runcontext.RunContext) (*SkaffoldRunner, error) {
event.InitializeState(runCtx)
event.LogMetaEvent()
eventV2.InitializeState(runCtx)
eventV2.LogMetaEvent()
_, endTrace := instrumentation.StartTrace(context.Background(), "NewForConfig")
defer endTrace()
tagger, err := tag.NewTaggerMux(runCtx)
if err != nil {
endTrace(instrumentation.TraceEndError(err))
return nil, fmt.Errorf("creating tagger: %w", err)
}
store := build.NewArtifactStore()
g := graph.ToArtifactGraph(runCtx.Artifacts())
sourceDependencies := graph.NewSourceDependenciesCache(runCtx, store, g)
isLocalImage := func(imageName string) (bool, error) {
return isImageLocal(runCtx, imageName)
}
// Always add skaffold-specific labels, except during `skaffold render`
labeller := label.NewLabeller(runCtx.AddSkaffoldLabels(), runCtx.CustomLabels(), runCtx.GetRunID())
tester, err := getTester(ctx, runCtx, isLocalImage)
if err != nil {
endTrace(instrumentation.TraceEndError(err))
return nil, fmt.Errorf("creating tester: %w", err)
}
View on GitHub (pinned to a1189de023)
Solutions
- Inspect the inner error and fix the `build.tagPolicy` entry in skaffold.yaml.
- For envTemplate, validate the Go template string and that all referenced env vars are set.
- For gitCommit tagger, run inside a git repo (`git status` should succeed) or switch to shaTagger.
- For dateTime tagger, use a valid IANA timezone (e.g. `UTC`, `America/New_York`) and supported format.
- Use `skaffold diagnose` to surface config-level problems early.
Example fix
// skaffold.yaml before
build:
tagPolicy:
envTemplate:
template: "{{.BAD{{""
// after
build:
tagPolicy:
envTemplate:
template: "{{.RELEASE}}" Defensive patterns
Strategy: validation
Validate before calling
for _, p := range pipelines {
if p.Build.TagPolicy.EnvTemplateTagger != nil {
if _, err := template.New("t").Parse(p.Build.TagPolicy.EnvTemplateTagger.Template); err != nil {
return fmt.Errorf("invalid envTemplate %q: %w", p.Build.TagPolicy.EnvTemplateTagger.Template, err)
}
}
} Try / catch
runner, err := runner.NewForConfig(runCtx)
if err != nil {
var tagErr = "creating tagger"
if strings.Contains(err.Error(), tagErr) {
return fmt.Errorf("skaffold.yaml build.tagPolicy is invalid: %w", err)
}
return err
} Prevention
- Run `skaffold diagnose` in CI before any build to validate tag policies.
- Prefer shaTagger or dateTimeTagger when git metadata is unavailable.
- Test envTemplate strings by rendering them in a unit test with the same env vars.
- Validate IANA timezones for dateTime tagger with time.LoadLocation.
When it happens
Trigger: Any skaffold command that builds a runner when `tag.NewTaggerMux` fails: invalid `envTemplate` syntax (bad Go template), custom template referencing unknown env vars/components, `gitCommit` tagger used outside a git repository, or DateTimeTagger with an invalid timezone/format.
Common situations: Tag policy like `envTemplate: "{{.FOO}}"` with a malformed template expression; running in a non-git directory with `gitCommit` tag policy; invalid IANA timezone in dateTime tagger; typo in customTemplate component args.
Related errors
- getting tagger: %w
- unexpected artifact type %q: %s
- image %q context %q is not a directory
- creating tester: %w
- no valid tagger found for artifact: %q
AI-assisted analysis of GoogleContainerTools/skaffold@a1189de023 (2026-09-05).
Data as JSON: /api/errors/7b331ddf5dabc5a2.
Report an issue: GitHub.