{"record":{"id":"4ec318fea1c05c1f","repo":"kubernetes/kops","slug":"error-parsing-template-q-v","errorCode":null,"errorMessage":"error parsing template %q: %v","messagePattern":"error parsing template %q: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/model/resources/template_resource.go","lineNumber":50,"sourceCode":"\n\tparsed *template.Template\n}\n\nvar _ fi.Resource = &templateResource{}\n\nfunc newTemplateResource(key string, definition string, functions template.FuncMap, context interface{}) (*templateResource, error) {\n\tr := &templateResource{\n\t\tkey:        key,\n\t\tdefinition: definition,\n\t\tcontext:    context,\n\t}\n\n\tt := template.New(key)\n\n\tt.Funcs(functions)\n\t_, err := t.Parse(definition)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error parsing template %q: %v\", key, err)\n\t}\n\n\tt.Option(\"missingkey=zero\")\n\n\tr.parsed = t\n\n\treturn r, nil\n}\n\nfunc (r *templateResource) Open() (io.Reader, error) {\n\tbuffer := &bytes.Buffer{}\n\n\terr := r.parsed.ExecuteTemplate(buffer, r.key, r.context)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error executing template %q: %v\", r.key, err)\n\t}\n\n\treturn buffer, nil","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/model/resources/template_resource.go#L32-L68","documentation":"The Go text/template definition passed to newTemplateResource failed to parse. This is a developer-facing error: the embedded template source (keyed by the name in the message) contains a syntax error such as an unmatched delimiter or bad function call.","triggerScenarios":"Thrown at pkg/model/resources/template_resource.go:50 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the template syntax reported in the wrapped parse error","Add any missing custom functions to the template FuncMap before parsing"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}