gofiber/fiber · error · ErrNoViewEngineConfigured

fiber: no view engine configured

Error message

fiber: no view engine configured

What it means

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.

Source

Thrown at error.go:22

	"encoding/json"
	"errors"

	"github.com/gofiber/schema"
)

// Wrap and return this for unreachable code if panicking is undesirable (i.e., in a handler).
// Unexported because users will hopefully never need to see it.
var errUnreachable = errors.New("fiber: unreachable code, please create an issue at github.com/gofiber/fiber")

// General errors
var (
	ErrGracefulTimeout = errors.New("shutdown: graceful timeout has been reached, exiting")
	// ErrNotRunning indicates that a Shutdown method was called when the server was not running.
	ErrNotRunning = errors.New("shutdown: server is not running")
	// ErrHandlerExited is returned by App.Test if a handler panics or calls runtime.Goexit().
	ErrHandlerExited = errors.New("runtime.Goexit() called in handler or server panic")
	// ErrNoViewEngineConfigured indicates that a helper requiring a view engine was invoked without one configured.
	ErrNoViewEngineConfigured = errors.New("fiber: no view engine configured")
	// ErrAutoCertWithCertFile indicates AutoCertManager cannot be used with CertFile/CertKeyFile.
	ErrAutoCertWithCertFile = errors.New("tls: AutoCertManager cannot be combined with CertFile/CertKeyFile")
)

// Fiber redirection errors
var (
	ErrRedirectBackNoFallback = NewError(StatusInternalServerError, "Referer not found, you have to enter fallback URL for redirection.")
)

// Range errors
var (
	// ErrRangeMalformed is returned for a syntactically invalid Range header,
	// which RFC 9110 Section 14.2 allows a server to reject; it carries a
	// 400 Bad Request status so propagating it does not surface as a 500.
	ErrRangeMalformed = NewError(StatusBadRequest, "range: malformed range header string")
	// ErrRangeUnsupported is returned for a Range header whose range unit is
	// not "bytes". RFC 9110 Section 14.2 requires an origin server to IGNORE
	// a Range header field with a range unit it does not understand, so

View on GitHub (pinned to 9a4c7e57fe)

Solutions

  1. Provide a view engine in Config.Views when creating the app, e.g. app := fiber.New(fiber.Config{Views: html.New("./views", ".html")}).
  2. Only invoke the reload path when app.Config.Views != nil.
  3. If you do not use views, remove the reload/restart logic that calls into it.

Example fix

// before
app := fiber.New()
// ... later, reload triggered -> ErrNoViewEngineConfigured

// after
app := fiber.New(fiber.Config{
    Views: html.New("./views", ".html"),
})
Defensive patterns

Strategy: validation

Validate before calling

// Only invoke view reload when an engine is configured.
if app.Config().Views != nil {
    if err := app.ReloadViews(); err != nil { /* handle */ }
}

Try / catch

if err := app.ReloadViews(); err != nil {
    if errors.Is(err, fiber.ErrNoViewEngineConfigured) {
        log.Println("no view engine; skipping reload")
    } else {
        return err
    }
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of gofiber/fiber@9a4c7e57fe (2026-08-04). Data as JSON: /data/errors/c983264731bbb8d6.json. Report an issue: GitHub.