{"record":{"id":"5f4dc3acdfc62fe3","repo":"GoogleContainerTools/skaffold","slug":"nested-customtemplate-components-are-not-supported","errorCode":null,"errorMessage":"nested customTemplate components are not supported in skaffold (%s)","messagePattern":"nested customTemplate components are not supported in skaffold \\((.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/skaffold/tag/tagger_mux.go","lineNumber":122,"sourceCode":"\t\tcase c.EnvTemplateTagger != nil:\n\t\t\tcomponents[name], _ = NewEnvTemplateTagger(c.EnvTemplateTagger.Template)\n\n\t\tcase c.ShaTagger != nil:\n\t\t\tcomponents[name] = &ChecksumTagger{}\n\n\t\tcase c.GitTagger != nil:\n\t\t\tcomponents[name], _ = NewGitCommit(c.GitTagger.Prefix, c.GitTagger.Variant, c.GitTagger.IgnoreChanges)\n\n\t\tcase c.DateTimeTagger != nil:\n\t\t\tcomponents[name] = NewDateTimeTagger(c.DateTimeTagger.Format, c.DateTimeTagger.TimeZone)\n\n\t\tcase c.InputDigest != nil:\n\t\t\tgraph := graph.ToArtifactGraph(runCtx.Artifacts())\n\t\t\tinputDigest, _ := NewInputDigestTagger(runCtx, graph)\n\t\t\tcomponents[name] = inputDigest\n\n\t\tcase c.CustomTemplateTagger != nil:\n\t\t\treturn nil, fmt.Errorf(\"nested customTemplate components are not supported in skaffold (%s)\", name)\n\n\t\tdefault:\n\t\t\treturn nil, fmt.Errorf(\"unknown component for custom template: %s %+v\", name, c)\n\t\t}\n\t}\n\n\treturn components, nil\n}\n","sourceCodeStart":104,"sourceCodeEnd":131,"githubUrl":"https://github.com/GoogleContainerTools/skaffold/blob/a1189de023efc32d4b8e11f395acc678aa555011/pkg/skaffold/tag/tagger_mux.go#L104-L131","documentation":"Custom template components may be envTemplate, sha256, gitCommit, dateTime, or inputDigest — but a component that is itself a customTemplate is explicitly rejected. This prevents unbounded recursion in template evaluation, so Skaffold returns this error naming the offending component.","triggerScenarios":"A tagPolicy.customTemplate.components entry whose `customTemplateTagger` field is set (nested custom template), encountered in CreateComponents.","commonSituations":"Misunderstanding component composition rules and nesting customTemplate for reuse; accidental YAML indentation making a nested block land as a component strategy.","solutions":["Flatten the nested custom template into its primitive components at the top level","Compute the inner template's value via envTemplate chaining or precomputed components instead","Remove the nested customTemplate block"],"exampleFix":"// before\ncomponents:\n  - name: OUTER\n    customTemplate:\n      template: \"{{.SHA}}\"\n      components:\n        - name: SHA\n          sha256: {}\n\n// after\ncomponents:\n  - name: SHA\n    sha256: {}\n# then reference {{.SHA}} directly in the outer template","handlingStrategy":"validation","validationCode":"for _, c := range tp.CustomTemplateTagger.Components {\n    if c.Component.CustomTemplateTagger != nil {\n        return fmt.Errorf(\"component %q must not be a customTemplate\", c.Name)\n    }\n}","typeGuard":"func isNestedCustom(c latest.TaggerComponent) bool {\n    return c.EnvTemplateTagger == nil && c.CustomTemplateTagger != nil\n}","tryCatchPattern":"t, err := tag.NewTaggerMux(runCtx)\nif err != nil && strings.Contains(err.Error(), \"nested customTemplate components are not supported\") {\n    return fmt.Errorf(\"flatten nested custom template components: %w\", err)\n}","preventionTips":["Document/enforce that components must be primitive strategies only","When refactoring templates for reuse, inline components instead of nesting","Validate config against the skaffold JSON schema which disallows nesting"],"tags":["skaffold","tagging","custom-template"],"backgroundTag":"nested-custom-template-unsupported","analyzedSha":"a1189de023efc32d4b8e11f395acc678aa555011","analyzedAt":"2026-09-05T12:09:27.064Z","contentChangedAt":"2026-09-05T12:09:27.064Z","schemaVersion":2},"datasetVersion":"2026-09-12T17:17:11.597Z"}