Documentation
Docs
Introduction
Getting Started
Tutorial: build an app
Core Concepts
Routing
Server-Side Rendering
Mimir, state management
Pages & Layouts
API Routes
Styling & Theming
Building & Deploying
API Reference
Guides
Recipes
FAQ (use cases)
Error and not-found
Two convention pages handle the unhappy paths: not-found for unmatched URLs (404) and error for
render failures (500). Both are plain components you provide to createApp.
The not-found page (404)
pages/not-found.tsx renders when no route matches. Wire it via createApp({ notFound }):
rune registers a catch-all (*) that renders NotFound with a 404 status and the request path as a
prop, so you can show the attempted URL:
The 404 is wrapped in an HTML shell (with your lang), so it is a complete page, not a bare fragment.
The error page (500)
pages/error.tsx renders when a page's server render throws. Wire it via createApp({ error }):
If an SSR render throws, rune logs the error server-side and returns a safe error response rather than leaking a stack trace to the client. Keep the error page generic and reassuring; do not render the actual error message to users.
Per-section error boundaries
The layout tree can carry an error handler per segment (layoutTree[seg].error), so a section can have its
own error UI. rune looks for the nearest error handler up the path from the failing route. For most apps the
single createApp({ error }) is enough; use per-segment handlers when a subtree (say /admin) should fail
differently from the rest of the site.
404 vs a route's own "not found" branch
There are two distinct "not found"s:
- No route matches the URL , rune renders your
notFoundpage (a real 404). Example:/totally/unknown. - A route matches, but its data is missing , the page renders its own "not found" content (still a 200,
because the route exists). Example: /notes/:id matched, but there is no note with that id.
Use the notFound page for unknown URLs; handle missing-data-within-a-known-route inside the page:
If you want a missing-data case to be a true 404 (for SEO/correctness), register a server redirect or render through a dynamic route that can set a 404 status, but for most UX, an in-page message is the right call.
Status codes
- Unmatched URL → 404 via
notFound. - SSR render throw → 500 via
error(logged server-side). - Matched route, missing data → 200 with in-page messaging (unless you deliberately 404 it).
That completes Pages & Layouts. Next: the server surface, API routes.