{"record":{"id":"37b3a6a271e6db78","repo":"hasura/graphql-engine","slug":"error-reading-from-file-path-s-w","errorCode":null,"errorMessage":"error reading from file: path: %s :%w","messagePattern":"error reading from file: path: (.+?) :%w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/pkg/console/template.go","lineNumber":95,"sourceCode":"\treturn err == nil\n}\n\nfunc (p *DefaultTemplateProvider) LoadTemplates(\n\tpath string,\n\ttemplateNames ...string,\n) (multitemplate.Render, error) {\n\tvar op errors.Op = \"console.DefaultTemplateProvider.LoadTemplates\"\n\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}","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/cli/pkg/console/template.go#L77-L113","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify the template exists before loading\np := console.NewTemplateProvider(...)\npath := p.BasePath() + templateVersion + \"/\" + p.TemplateFilename()\nif _, err := p.ConsoleFS().ReadFile(path); err != nil {\n    return fmt.Errorf(\"template missing: %s\", path)\n}","typeGuard":null,"tryCatchPattern":"render, err := p.LoadTemplates(path, name)\nif err != nil && strings.Contains(err.Error(), \"error reading from file\") {\n    // asset path/version mismatch: reinstall CLI or fix provider FS\n}","preventionTips":["Don't override embedded console assets casually","Match templateVersion to the assets actually shipped","Test asset paths when customizing the console"],"tags":["console","template","embedded-fs","hasura"],"backgroundTag":"template-load-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}