{"record":{"id":"71b7bf6091c72f0d","repo":"argoproj/argo-workflows","slug":"template-s-type-is-unknown","errorCode":null,"errorMessage":"template '%s' type is unknown","messagePattern":"template '(.+?)' type is unknown","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/templateresolution/context.go","lineNumber":252,"sourceCode":"\t\t\t\t}\n\t\t\t\tinlineResourceName = tmplRef.Name\n\t\t\t}\n\t\t\terr = tplCtx.workflow.SetStoredInlineTemplate(inlineScope, inlineResourceName, newTmpl)\n\t\t\tif err != nil {\n\t\t\t\ttplCtx.log.WithError(err).Error(ctx, \"Failed to store the inline template\")\n\t\t\t}\n\t\t}\n\t\ttmpl = newTmpl\n\t}\n\n\t// Update the template base of the context.\n\tnewTmplCtx, err := tplCtx.WithTemplateHolder(ctx, tmplHolder)\n\tif err != nil {\n\t\treturn nil, nil, false, err\n\t}\n\n\tif tmpl.GetType() == wfv1.TemplateTypeUnknown {\n\t\treturn nil, nil, false, fmt.Errorf(\"template '%s' type is unknown\", tmpl.Name)\n\t}\n\n\treturn newTmplCtx, tmpl, templateStored, nil\n}\n\n// WithTemplateHolder creates new context with a template base of a given template holder.\nfunc (tplCtx *TemplateContext) WithTemplateHolder(ctx context.Context, tmplHolder wfv1.TemplateReferenceHolder) (*TemplateContext, error) {\n\ttmplRef := tmplHolder.GetTemplateRef()\n\tif tmplRef != nil {\n\t\ttmplName := tmplRef.Name\n\t\tif tmplRef.ClusterScope {\n\t\t\treturn tplCtx.WithClusterWorkflowTemplate(ctx, tmplName)\n\t\t}\n\t\treturn tplCtx.WithWorkflowTemplate(ctx, tmplName)\n\t}\n\treturn tplCtx.WithTemplateBase(tplCtx.tmplBase), nil\n}\n","sourceCodeStart":234,"sourceCodeEnd":270,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/templateresolution/context.go#L234-L270","documentation":"During template resolution, ResolveTemplate fetches a template from a holder (workflow spec, workflow template, cluster workflow template, or stored template) and checks its type. If the resolved template's type is wfv1.TemplateTypeUnknown — i.e. the template exists but has no recognizable type (container, script, steps, dag, suspend, etc.) — resolution fails. This catches templates that are defined but effectively empty/unusable.","triggerScenarios":"templateRef/template name resolves to a template whose spec lacks any type-defining field (no container, script, steps, dag, resource, suspend, data, http, plugin), e.g. an empty template {} in a WorkflowTemplate referenced via workflowTemplateRef or a stored template whose type could not be derived.","commonSituations":"Referencing the wrong template name in a WorkflowTemplate; a template with only metadata and no body; CRD/schema version mismatch where template fields fail to deserialize so type is lost; copy-pasted placeholder templates.","solutions":["Give the referenced template a valid type body (container, script, steps, dag, suspend, etc.) in the WorkflowTemplate","Verify the template name in templateRef/template points at the intended template (kubectl get workflowtemplate -o yaml)","Re-apply the WorkflowTemplate CRD/version so fields deserialize correctly, then resubmit the workflow"],"exampleFix":"// before (WorkflowTemplate)\ntemplates:\n  - name: main\n    {}\n// after\ntemplates:\n  - name: main\n    container:\n      image: alpine\n      command: [echo, hello]","handlingStrategy":"validation","validationCode":"for _, t := range wt.Spec.Templates {\n    if t.GetType() == wfv1.TemplateTypeUnknown {\n        return fmt.Errorf(\"template %q in %s has no type body\", t.Name, wt.Name)\n    }\n}","typeGuard":"func hasKnownTemplateType(t *wfv1.Template) bool {\n    return t.GetType() != wfv1.TemplateTypeUnknown\n}","tryCatchPattern":"wf, err := client.ArgoprojV1alpha1().Workflows(ns).Create(ctx, wf, metav1.CreateOptions{})\nif err != nil && strings.Contains(err.Error(), \"type is unknown\") {\n    // inspect the referenced WorkflowTemplate for an empty template body\n}","preventionTips":["Always give templates a concrete body (container/script/steps/dag/...) before referencing them","Run argo lint on WorkflowTemplates in CI before workflows reference them","Keep the WorkflowTemplate CRD and controller versions in sync"],"tags":["template","validation","templateresolution"],"backgroundTag":"unknown-template-type","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}