{"record":{"id":"32196332b0ec6e98","repo":"hasura/graphql-engine","slug":"error-creating-template-path-s-name-s-w","errorCode":null,"errorMessage":"error creating template: path: %s, name: %s: %w","messagePattern":"error creating template: path: (.+?), name: (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/pkg/console/template.go","lineNumber":103,"sourceCode":"\n\tr := multitemplate.New()\n\n\tfor _, templateName := range templateNames {\n\t\ttemplatePath := path + templateName\n\n\t\ttemplateBytes, err := p.consoleFS.ReadFile(templatePath)\n\t\tif err != nil {\n\t\t\treturn nil, errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\"error reading from file: path: %s :%w\", templatePath, err),\n\t\t\t)\n\t\t}\n\n\t\ttheTemplate, err := template.New(templateName).Parse(string(templateBytes))\n\t\tif err != nil {\n\t\t\treturn nil, errors.E(\n\t\t\t\top,\n\t\t\t\tfmt.Errorf(\n\t\t\t\t\t\"error creating template: path: %s, name: %s: %w\",\n\t\t\t\t\tpath,\n\t\t\t\t\ttemplateName,\n\t\t\t\t\terr,\n\t\t\t\t),\n\t\t\t)\n\t\t}\n\n\t\tr.Add(templateName, theTemplate)\n\t}\n\n\treturn r, nil\n}\n\n// GetTemplateVersion returns the template version tv required to render\n// the console html.\nfunc (p *DefaultTemplateProvider) GetTemplateVersion(v *version.Version) string {\n\t// pre-release builds","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/pkg/console/template.go#L85-L121","documentation":"After reading the console template bytes, LoadTemplates parses them with text/template; a syntax error in console.gohtml produces 'error creating template' with the path and template name. Only happens with custom/modified templates — the shipped embedded template is well-formed.","triggerScenarios":"Supplying a hand-edited or custom console.gohtml containing invalid template syntax (unclosed {{if}}, bad pipelines) that template.New(...).Parse rejects during BuildConsoleRouter.","commonSituations":"Customizing the console template and introducing syntax errors; template files edited with tools that mangle {{ }} delimiters; version upgrades changing expected template structure.","solutions":["Validate the template: go run a snippet that parses console.gohtml with text/template to see the exact syntax error","Fix or revert the offending {{ ... }} constructs","Re-extract the original template from the CLI release if it was modified","Test template changes before starting the console"],"exampleFix":"// before\n<html>{{ if loggedIn }} ...   <!-- missing {{ end }} -->\n\n// after\n<html>{{ if loggedIn }} ... {{ end }}","handlingStrategy":"validation","validationCode":"// Parse-check custom templates at build time\nif _, err := template.New(\"console.gohtml\").ParseFiles(tplPath); err != nil {\n    return fmt.Errorf(\"template syntax error: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"render, err := p.LoadTemplates(path, name)\nif err != nil && strings.Contains(err.Error(), \"error creating template\") {\n    // parse files with text/template locally to locate the syntax error\n}","preventionTips":["Lint modified templates by parsing them in CI","Diff custom templates against shipped ones before upgrades","Avoid hand-editing console.gohtml unless necessary"],"tags":["console","go-template","syntax-error","hasura"],"backgroundTag":"template-parse-error","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}