If a data provider does not respond, the product has not necessarily been removed. However, the page may display “Product not found” because of a generic error handler. Visitors see a message saying the product is missing, while search engine crawlers receive a signal the developer intended for a removed listing. The fix belongs in the code’s decision logic, not in the template’s wording.
We’ll look at our own educational example of a store built with Next.js 15 and the App Router. The /catalog/red-mug product page fetches the product from an API. This URL and the API responses are used only for explanation; they are not the results of an audit of a real store. For Pages Router and other major versions, you’ll need to check the corresponding data-fetching mechanism.
When a product is missing and when the check did not complete
First, agree on the API contract. In our example, 404 means that a product with this URL genuinely does not exist. 200 returns a published listing. 500, 502, a timeout, and invalid JSON mean the application could not retrieve verified information.
The provider may not use this exact contract. Sometimes absence is indicated by 200 with a found: false field, while a 404 response comes from the API route itself being misconfigured. Check the documentation and inspect the saved responses. You cannot treat a product as removed if the application called the wrong service or lost authorization.
| Source response | What is known | What the interface should do |
|---|---|---|
Confirmed 404 for the product | The listing does not exist | Show the intended missing-item state |
Successful 200 with the expected data | The product was found | Display the listing |
401 or 403 | Authorization failed | Log the access problem; do not declare the product removed |
500 or a timeout | The data is unknown | Handle a temporary failure |
200 with invalid JSON | The data is unusable | Handle a format error |
Find the place that hides different causes
A common source of the problem is a function that returns null after any error. The next line, if (!product) notFound(), no longer knows whether the product was removed or the server stopped responding. This makes for short code, but it makes it impossible to explain the result correctly.
Check the product-fetching function, the shared API client, and the page component. All three matter: the distinction may be lost deeper in the code than the page suggests. Searching for notFound( and catch can help you find candidates, but a match alone does not prove there is a problem. Compare the matching branch with the specific failed request.
Ask the developer to temporarily log the request ID, the source route without secrets, and its status. There is no need to put authorization tokens, customer personal information, or the full response from an internal service in public logs. The log entry should make it possible to connect the page failure to the API response.
Separate handling in the server page
Below is an educational example of app/catalog/[slug]/page.tsx. The CATALOG_API_ORIGIN variable should point to your trusted API. The example intentionally does not use caching: first, we check that different responses are handled correctly. Adapt the JSON schema, authorization, and publication rules to the actual source.
import { notFound } from 'next/navigation'
type Product = { name: string; slug: string }
async function loadProduct(slug: string): Promise<Product | null> {
const origin = process.env.CATALOG_API_ORIGIN
if (!origin) throw new Error('Catalog API is not configured')
const url = new URL(`/products/${encodeURIComponent(slug)}`, origin)
const response = await fetch(url, {
cache: 'no-store',
signal: AbortSignal.timeout(5000),
})
if (response.status === 404) return null
if (!response.ok) throw new Error(`Catalog API status ${response.status}`)
const product: unknown = await response.json()
if (!product || typeof product !== 'object'
|| !('name' in product) || typeof product.name !== 'string'
|| !('slug' in product) || product.slug !== slug) {
throw new Error('Unexpected catalog response')
}
return product as Product
}
export default async function ProductPage({
params,
}: { params: Promise<{ slug: string }> }) {
const { slug } = await params
const product = await loadProduct(slug)
if (product === null) notFound()
return <main><h1>{product.name}</h1></main>
}notFound() ends rendering for the segment and adds noindex. So call it only after confirming the product is missing. This behavior is described in the Next.js 15 documentation. Errors while fetching data remain errors in this example: they are not converted into null.
Prepare a message for a temporary failure
In the relevant segment’s error.tsx, you can show a clear message: “Couldn’t load the product. Please try again.” For visitors, the next step matters more than the name of an internal exception. Don’t display an unhandled error.message: it may reveal how the service is built, and it won’t explain what to do.
A missing-product page has its own flow: a link to the catalog, search, or the nearest relevant section. For a temporary failure, offer a way to try again. The distinction is also useful to support staff: they won’t tell someone that a listing was removed when the source is simply unavailable. General rules for errors in server components and nested boundaries are covered in the error handling documentation.
Don’t promise visitors that trying again will definitely help. If the API is unavailable for a long time, the button will only repeat the failed request. The team should receive an alert about the source failure and have a way to temporarily disable the affected flow or show verified cached data with its actual date.
Check responses outside in-app navigation
Set up a test source with four modes: a normal product, confirmed absence, a temporary 503, and invalid JSON. Open each URL directly in a new window. Then navigate to each one from the catalog. Compare the message, server logs, main document status, and whether noindex is present.
You cannot determine a page’s status solely from the API request status in the Network panel. These are two different responses. Also, in the App Router, a streaming response that has already started can retain 200, even when a missing-item state occurs later. This separate case is covered in the article about notFound and streaming responses.
After the fix, run a technical page audit and compare it with your manual checks. The audit records the response it receives, but it does not reproduce all your test modes or prove that the API will remain stable under load. For the overall project structure, see the Next.js 15 guide.
How to accept the developer’s work
In the task, specify the original URL, the type of temporary failure, and the expected distinction between states. Attach an anonymized example of an API response. Ask the developer to show where handling for confirmed absence ends and handling for an unknown result begins.
Acceptance testing should include an existing product, a missing product, an authorization error, a timeout, and invalid data. Once the API recovers, the existing listing should open again with its previous content; it should not need to be manually restored from a “removed” state. No source errors should be recorded as proof that a product was removed.
Finally, check that the developer did not “fix” the problem simply by removing all notFound(). Genuine missing listings also need to be handled appropriately. The goal of the change is to preserve the correct response for every confirmed state and honestly indicate situations where data is not yet available.