hasura/graphql-engine · error
error creating template: path: %s, name: %s: %w
Error message
error creating template: path: %s, name: %s: %w
What it means
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.
Source
Thrown at cli/pkg/console/template.go:103
r := multitemplate.New()
for _, templateName := range templateNames {
templatePath := path + templateName
templateBytes, err := p.consoleFS.ReadFile(templatePath)
if err != nil {
return nil, errors.E(
op,
fmt.Errorf("error reading from file: path: %s :%w", templatePath, err),
)
}
theTemplate, err := template.New(templateName).Parse(string(templateBytes))
if err != nil {
return nil, errors.E(
op,
fmt.Errorf(
"error creating template: path: %s, name: %s: %w",
path,
templateName,
err,
),
)
}
r.Add(templateName, theTemplate)
}
return r, nil
}
// GetTemplateVersion returns the template version tv required to render
// the console html.
func (p *DefaultTemplateProvider) GetTemplateVersion(v *version.Version) string {
// pre-release buildsView on GitHub (pinned to 724551b9ae)
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
Example fix
// before
<html>{{ if loggedIn }} ... <!-- missing {{ end }} -->
// after
<html>{{ if loggedIn }} ... {{ end }} Defensive patterns
Strategy: validation
Validate before calling
// Parse-check custom templates at build time
if _, err := template.New("console.gohtml").ParseFiles(tplPath); err != nil {
return fmt.Errorf("template syntax error: %w", err)
} Try / catch
render, err := p.LoadTemplates(path, name)
if err != nil && strings.Contains(err.Error(), "error creating template") {
// parse files with text/template locally to locate the syntax error
} Prevention
- Lint modified templates by parsing them in CI
- Diff custom templates against shipped ones before upgrades
- Avoid hand-editing console.gohtml unless necessary
When it happens
Trigger: Supplying a hand-edited or custom console.gohtml containing invalid template syntax (unclosed {{if}}, bad pipelines) that template.New(...).Parse rejects during BuildConsoleRouter.
Common situations: Customizing the console template and introducing syntax errors; template files edited with tools that mangle {{ }} delimiters; version upgrades changing expected template structure.
Related errors
- error serving console: %w
- error creating migrate instance: %w
- error starting server: %w
- cannot fetch template: %w
- cannot create console server: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/32196332b0ec6e98.
Report an issue: GitHub.