The “Not Found” message and the HTTP status do not always match. In Next.js 15 with the App Router, the notFound() state can occur after the server has already started sending the document. By then, the headers have been sent, so a later not-found state cannot turn the response already in progress into a new response with a different status.
This is a distinct case from a custom error template where the application simply returns the text “Product not found” inside a regular successful page. Let’s look at both scenarios using our own educational example. This is not the result of checking a real store; the code is for reproducing the behavior in a test environment.
What streaming means for the status
With streaming, the browser receives the document in chunks. For example, the general interface and a loading screen might appear first, followed by the result of fetching the product data. If the product is then confirmed to be missing, the HTTP headers that have already been sent cannot be changed.
Next.js explicitly describes the difference: not-found returns 200 for streaming responses and 404 for non-streaming responses. So seeing 200 does not prove that the not-found function failed to run. not-found documentation for version 15.
But the opposite conclusion is also incorrect. The presence of 200 next to the text “Not Found” does not, by itself, prove that Next.js handled the case correctly. You need to find which code created the message, whether streaming had already started, and which search directives are present in the completed response.
Distinguish notFound from a simple message
In the first scenario, the page returns return <p>Товар не найден</p>. Returning this value does not, by itself, set 404 or mean that the notFound mechanism was called. In the second scenario, the page calls the function imported from next/navigation, notFound(), after which the corresponding not-found UI file is used.
The function also adds noindex. This is an important part of the check, especially when the document’s initial status is already 200. The function’s behavior is described in the notFound reference. Check the not-found signal and search directive together rather than guessing from how the screen looks.
Find the exact branch for the URL in question. If notFound() exists in the project but is only called on another page, that does not explain this case. Ask to see the data flow: retrieving the record, deciding whether it exists, calling the function, and the not-found.tsx component for this segment.
Reproduce a late not-found state in a test environment
The educational page app/catalog/[slug]/page.tsx below returns one existing product. For any other slug, it deliberately waits one and a half seconds and calls notFound. The delay is only for the experiment and should not be used in a production catalog.
import { notFound } from 'next/navigation'
export default async function ProductPage({ params }: {
params: Promise<{ slug: string }>
}) {
const { slug } = await params
if (slug === 'red-mug') return <h1>Красная кружка</h1>
await new Promise((resolve) => setTimeout(resolve, 1500))
notFound()
}Add app/catalog/[slug]/loading.tsx and not-found.tsx. The first file creates the loading screen provided for the segment; the second displays the not-found message. In your own project, check which layout wraps these files.
// loading.tsx
export default function LoadingProduct() {
return <p>Загружаем сведения о товаре.</p>
}// not-found.tsx
import Link from 'next/link'
export default function MissingProduct() {
return <section>
<h1>Товар не найден</h1>
<p>Проверьте адрес или выберите товар в каталоге.</p>
<Link href="/catalog">Открыть каталог</Link>
</section>
}Run a production build and start it in a test environment. Open an existing /catalog/red-mug and a known-missing /catalog/missing-mug. Repeat the experiment separately without loading.tsx. The result also depends on other suspense boundaries in your tree, so removing a single file is not a universal guarantee that the status will change.
Preserve the document and check noindex
In the Network panel, select the main document request. Do not confuse it with an API, image, prefetch, or React Server Components request. For an additional check, you can save the headers and full HTML using a regular GET request to the test environment.
curl -sS -D /tmp/missing-product.headers \
-o /tmp/missing-product.html \
https://staging.example.ru/catalog/missing-mugThe address in the command is illustrative. Use a test environment you are authorized to access, not a random third-party domain. In the headers file, find the main response’s status. In the completed HTML, look for the search directive, then compare it with the final browser DOM. An early document fragment may not yet include markup added later.
If a proxy or CDN sits in front of the application, compare behavior through it and directly in your own test environment. An intermediary server may buffer the stream or replace the response with its own error page. Save the User-Agent and cache settings used so that the next test checks the same scenario.
Record results separately for an existing and a missing product. A real product page should not have a noindex left over from a shared template. If this directive also appears on regular pages, investigate metadata inheritance, not just the not-found state.
Decide whether your route needs a strict 404
If an external consumer requires exactly 404, the existence check must finish before the corresponding response headers are sent. The developer should propose an implementation for this route and confirm it with a test. Changing the message in not-found.tsx does not change when the decision is made.
Do not disable streaming across the entire site for the sake of one product page without assessing the consequences. First find out where the late decision comes from, whether existence can be checked earlier, and which parts actually need to wait. The right option depends on the data source, caching, and route structure.
In Next.js 15, there is an experimental global-not-found for non-existent application routes. It is not an automatic solution for a missing record inside an existing dynamic route /catalog/[slug]. Any slug may already match this route, while the product’s existence is determined separately.
Also check why the record was marked as missing. If a shared catch turns an API timeout into notFound, first fix the distinction between the causes. The correct status for a genuinely deleted product does not justify reporting that a product was deleted when the service has simply failed.
Acceptance criteria for the fix
Agree on the expected result for three cases: an existing product, confirmed absence, and a temporary failure of the data source. For each, record the document status, final URL, interface, and search directives. If a streaming 200 is acceptable under your requirements, that should be an explicit decision, not an accidentally missed check.
After deploying the fix, repeat the direct request and compare it with navigation from the catalog. If caching is enabled, check a fresh request and the next regular page load. An error disappearing only in development mode does not confirm the production route’s behavior.
A technical page audit can document the response and available findings as of the inspection date. It does not replace testing the suspense boundaries and all API responses. The overall route structure is covered in the Next.js 15 guide.
A successful fix gives the team a reproducible explanation of the response and clear handling for each state. It does not guarantee a search engine’s indexing decision; that is monitored separately after the page is crawled again.