hasura/graphql-engine · error
error reading from file: path: %s :%w
Error message
error reading from file: path: %s :%w
What it means
LoadTemplates reads console.gohtml from the console filesystem (p.consoleFS.ReadFile); an IO failure is wrapped with the exact template path. Usually the embedded asset is missing for the requested templateVersion, or a custom/overridden FS doesn't contain the file.
Source
Thrown at cli/pkg/console/template.go:95
return err == nil
}
func (p *DefaultTemplateProvider) LoadTemplates(
path string,
templateNames ...string,
) (multitemplate.Render, error) {
var op errors.Op = "console.DefaultTemplateProvider.LoadTemplates"
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)
}View on GitHub (pinned to 724551b9ae)
Solutions
- Upgrade the CLI so embedded templates match; clear cached console assets
- Verify the computed path exists: check templateVersion and BasePath from the provider
- If supplying a custom FS, ensure console.gohtml is at <BasePath>/<version>/console.gohtml
- Check read permissions on the template path
Defensive patterns
Strategy: validation
Validate before calling
// Verify the template exists before loading
p := console.NewTemplateProvider(...)
path := p.BasePath() + templateVersion + "/" + p.TemplateFilename()
if _, err := p.ConsoleFS().ReadFile(path); err != nil {
return fmt.Errorf("template missing: %s", path)
} Try / catch
render, err := p.LoadTemplates(path, name)
if err != nil && strings.Contains(err.Error(), "error reading from file") {
// asset path/version mismatch: reinstall CLI or fix provider FS
} Prevention
- Don't override embedded console assets casually
- Match templateVersion to the assets actually shipped
- Test asset paths when customizing the console
When it happens
Trigger: BuildConsoleRouter → LoadTemplates with a path like <base>/<templateVersion>/console.gohtml that doesn't exist in consoleFS: stale CLI with different embedded version, tampered assets, or a custom template provider pointing at the wrong base path.
Common situations: Mixing CLI versions with cached console assets; overriding the templates dir; templateVersion pinned to a version not present in the FS; file permission problems on a real (non-embedded) FS.
Related errors
- cannot fetch template: %w
- error serving console: %w
- error creating migrate instance: %w
- error starting server: %w
- cannot create console server: %w
AI-assisted analysis of hasura/graphql-engine@724551b9ae (2026-08-28).
Data as JSON: /api/errors/37b3a6a271e6db78.
Report an issue: GitHub.