kataras/iris · error
no engine was registered
Error message
no engine was registered
What it means
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.
Source
Thrown at view/view.go:98
// Funcs registers a template func map to the registered view engine(s).
func (v *View) Funcs(m template.FuncMap) *View {
if !v.Registered() {
return v
}
if e, ok := v.Engine.(EngineFuncer); ok {
for k, v := range m {
e.AddFunc(k, v)
}
}
return v
}
// Load compiles all the registered engines.
func (v *View) Load() error {
if !v.Registered() {
return fmt.Errorf("no engine was registered")
}
return v.Engine.Load()
}
// NoLayout disables the configuration's layout for a specific execution.
const NoLayout = "iris.nolayout"
// returns empty if it's no layout or empty layout and empty configuration's layout.
func getLayout(layout string, globalLayout string) string {
if layout == NoLayout {
return ""
}
if layout == "" && globalLayout != "" {
return globalLayout
}
return layoutView on GitHub (pinned to 7bedaf55a0)
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.
Example fix
// before
v := view.New(view.HTML("./views", ".html"))
app.View(v) // forgot v.Load / engine not registered
// after
engine := view.HTML("./views", ".html")
v := view.New(engine)
engine.Register(v) // or pass engine to view.New which registers it
if err := v.Load(); err != nil { panic(err) }
app.View(v) Defensive patterns
Strategy: validation
Validate before calling
if !v.Registered() {
panic("view: no engine registered — call engine.Register(view) before Load")
} Try / catch
if err := v.Load(); err != nil {
if err.Error() == "no engine was registered" {
log.Fatal("bootstrap bug: register a view engine before Load")
}
return err
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- no templates found
- directoryPath is empty
- path is required
- auth: signin: no provider
- auth: refresh: disabled
AI-assisted analysis of kataras/iris@7bedaf55a0 (2026-08-30).
Data as JSON: /api/errors/03461c25a7f4338d.
Report an issue: GitHub.