{"record":{"id":"03461c25a7f4338d","repo":"kataras/iris","slug":"no-engine-was-registered","errorCode":null,"errorMessage":"no engine was registered","messagePattern":"no engine was registered","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"view/view.go","lineNumber":98,"sourceCode":"// Funcs registers a template func map to the registered view engine(s).\nfunc (v *View) Funcs(m template.FuncMap) *View {\n\tif !v.Registered() {\n\t\treturn v\n\t}\n\n\tif e, ok := v.Engine.(EngineFuncer); ok {\n\t\tfor k, v := range m {\n\t\t\te.AddFunc(k, v)\n\t\t}\n\t}\n\n\treturn v\n}\n\n// Load compiles all the registered engines.\nfunc (v *View) Load() error {\n\tif !v.Registered() {\n\t\treturn fmt.Errorf(\"no engine was registered\")\n\t}\n\treturn v.Engine.Load()\n}\n\n// NoLayout disables the configuration's layout for a specific execution.\nconst NoLayout = \"iris.nolayout\"\n\n// returns empty if it's no layout or empty layout and empty configuration's layout.\nfunc getLayout(layout string, globalLayout string) string {\n\tif layout == NoLayout {\n\t\treturn \"\"\n\t}\n\n\tif layout == \"\" && globalLayout != \"\" {\n\t\treturn globalLayout\n\t}\n\n\treturn layout","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/kataras/iris/blob/7bedaf55a0b64bbb2248a5845a2c60d81a30996a/view/view.go#L80-L116","documentation":"View.Load compiles all registered engines, but if no engine was registered on the View instance (Registered() is false) there is nothing to load, so it returns \"no engine was registered\". It guards against using a View that was never configured with an engine.","triggerScenarios":"Calling View.Load() (or registering the View with the app) before calling any engine Register method such as view.HTML(...).Register()/Handlebars(...)/Jet(...) on that View.","commonSituations":"Creating view.New(view.HTML(...)) but forgetting to chain .Register on the engine before boot; conditional registration code path skipped (e.g. disabled flag) leaving the View empty; constructing a bare &view.View{} manually.","solutions":["Register at least one engine on the View before Load, e.g. view.HTML(\"./views\", \".html\").Register(view).","Check v.Registered() before calling Load in custom bootstrap code.","Ensure configuration/flags that gate engine registration cannot silently skip it."],"exampleFix":"// before\nv := view.New(view.HTML(\"./views\", \".html\"))\napp.View(v) // forgot v.Load / engine not registered\n// after\nengine := view.HTML(\"./views\", \".html\")\nv := view.New(engine)\nengine.Register(v) // or pass engine to view.New which registers it\nif err := v.Load(); err != nil { panic(err) }\napp.View(v)","handlingStrategy":"validation","validationCode":"if !v.Registered() {\n    panic(\"view: no engine registered — call engine.Register(view) before Load\")\n}","typeGuard":null,"tryCatchPattern":"if err := v.Load(); err != nil {\n    if err.Error() == \"no engine was registered\" {\n        log.Fatal(\"bootstrap bug: register a view engine before Load\")\n    }\n    return err\n}","preventionTips":["Always construct the View via view.New(engine) so registration cannot be forgotten.","Never conditionally skip engine registration based on config without a guard.","Check Registered() in custom wrapper code before delegating to Load/ExecuteWriter.","Cover application boot with a test that calls View.Load once."],"tags":["view-engine","configuration","missing-registration","boot"],"backgroundTag":"no-engine-registered","analyzedSha":"7bedaf55a0b64bbb2248a5845a2c60d81a30996a","analyzedAt":"2026-08-30T20:38:16.250Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}