not-found.tsx
A special file that renders a custom "not found" screen when a route does not exist or notFound() is called.
In more detail
The nearest not-found.tsx above the call is used, so sections can have their own messages. It can be a Server Component, and Next.js sends a 404 status, or a noindex tag when streaming has already started.
Related terms
- notFound() — A function from next/navigation that stops rendering and shows the nearest not-found.tsx with a 404 status.
- 404 Not Found — The HTTP status meaning there is no resource at the requested address.
Taught in
- Error Boundaries: Nested error.tsx & Reset Logic — Next.js 15 & Modern App Router Architecture
- Not Found Handling: not-found.tsx & Programmatic Exits — Next.js 15 & Modern App Router Architecture