{"id":"c983264731bbb8d6","repo":"gofiber/fiber","slug":"fiber-no-view-engine-configured","errorCode":null,"errorMessage":"fiber: no view engine configured","messagePattern":"fiber: no view engine configured","errorType":"exception","errorClass":"ErrNoViewEngineConfigured","httpStatus":null,"severity":"error","filePath":"error.go","lineNumber":22,"sourceCode":"\t\"encoding/json\"\n\t\"errors\"\n\n\t\"github.com/gofiber/schema\"\n)\n\n// Wrap and return this for unreachable code if panicking is undesirable (i.e., in a handler).\n// Unexported because users will hopefully never need to see it.\nvar errUnreachable = errors.New(\"fiber: unreachable code, please create an issue at github.com/gofiber/fiber\")\n\n// General errors\nvar (\n\tErrGracefulTimeout = errors.New(\"shutdown: graceful timeout has been reached, exiting\")\n\t// ErrNotRunning indicates that a Shutdown method was called when the server was not running.\n\tErrNotRunning = errors.New(\"shutdown: server is not running\")\n\t// ErrHandlerExited is returned by App.Test if a handler panics or calls runtime.Goexit().\n\tErrHandlerExited = errors.New(\"runtime.Goexit() called in handler or server panic\")\n\t// ErrNoViewEngineConfigured indicates that a helper requiring a view engine was invoked without one configured.\n\tErrNoViewEngineConfigured = errors.New(\"fiber: no view engine configured\")\n\t// ErrAutoCertWithCertFile indicates AutoCertManager cannot be used with CertFile/CertKeyFile.\n\tErrAutoCertWithCertFile = errors.New(\"tls: AutoCertManager cannot be combined with CertFile/CertKeyFile\")\n)\n\n// Fiber redirection errors\nvar (\n\tErrRedirectBackNoFallback = NewError(StatusInternalServerError, \"Referer not found, you have to enter fallback URL for redirection.\")\n)\n\n// Range errors\nvar (\n\t// ErrRangeMalformed is returned for a syntactically invalid Range header,\n\t// which RFC 9110 Section 14.2 allows a server to reject; it carries a\n\t// 400 Bad Request status so propagating it does not surface as a 500.\n\tErrRangeMalformed = NewError(StatusBadRequest, \"range: malformed range header string\")\n\t// ErrRangeUnsupported is returned for a Range header whose range unit is\n\t// not \"bytes\". RFC 9110 Section 14.2 requires an origin server to IGNORE\n\t// a Range header field with a range unit it does not understand, so","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/gofiber/fiber/blob/9a4c7e57fe0b080a04235d28a4b0d2b4b353d58c/error.go#L4-L40","documentation":"ErrNoViewEngineConfigured (error.go:22) is returned (app.go:936) by the view-reload path when ReloadViews is called but app.config.Views is nil. The reload logic needs an existing Views engine to call Load() on; without one there is nothing to reload, so it reports the misconfiguration rather than dereferencing a nil engine.","triggerScenarios":"Calling the view-reload helper (triggered during graceful restart / hot reload) without first assigning fiber.Config{Views: engine} at App construction. Also hit in tests or dev tooling that exercises reload on an app created with config.New() and no Views.","commonSituations":"Setting up hot-reload for templates but forgetting to install the view engine (e.g. html.New views engine), or assigning Views after creation in a way the reload path doesn't observe.","solutions":["Provide a view engine in Config.Views when creating the app, e.g. app := fiber.New(fiber.Config{Views: html.New(\"./views\", \".html\")}).","Only invoke the reload path when app.Config.Views != nil.","If you do not use views, remove the reload/restart logic that calls into it."],"exampleFix":"// before\napp := fiber.New()\n// ... later, reload triggered -> ErrNoViewEngineConfigured\n\n// after\napp := fiber.New(fiber.Config{\n    Views: html.New(\"./views\", \".html\"),\n})","handlingStrategy":"validation","validationCode":"// Only invoke view reload when an engine is configured.\nif app.Config().Views != nil {\n    if err := app.ReloadViews(); err != nil { /* handle */ }\n}","typeGuard":null,"tryCatchPattern":"if err := app.ReloadViews(); err != nil {\n    if errors.Is(err, fiber.ErrNoViewEngineConfigured) {\n        log.Println(\"no view engine; skipping reload\")\n    } else {\n        return err\n    }\n}","preventionTips":["Pass Views in fiber.Config at construction.","Gate reload behind a nil-check on Config.Views.","If you don't render templates, remove reload logic entirely."],"tags":["views","config","templates","fiber"],"analyzedSha":"9a4c7e57fe0b080a04235d28a4b0d2b4b353d58c","analyzedAt":"2026-08-04T21:44:03.395Z","schemaVersion":2}