Skip to content

Invalid routes for dynamic pages return 200 response on first render #95380

Description

@lmounsey

Link to the code that reproduces this issue

https://github.com/lmounsey/cache-components-dynamic-routes

To Reproduce

  1. Build the application using next build
  2. Start application server using next start
  3. Visit invalid page route, e.g. http://localhost:3000/this-page-does-not-exist
  4. See 200 response
Image

Current vs. Expected behavior

In 16.2.x dynamic routes that are invalid correctly return a 404 response on first render when using cacheComponents.

There seems to be a change/regression with 16.3.x, where it looks like it first returns a static shell (200 response) on first load. Once cached, the page then correctly returns a 404 response.

I would expect the page to return a 404 on first render, otherwise this could have an impact on SEO, reporting and monitoring.

We rely on dynamic routes so new content can be published from the CMS instantly.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jan 19 22:01:13 PST 2026; root:xnu-11417.140.69.708.3~1/RELEASE_ARM64_T8122
  Available memory (MB): 24576
  Available CPU cores: 8
Binaries:
  Node: 25.2.1
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.17.1
Relevant Packages:
  next: 16.3.0-canary.73 // Latest available version is detected (16.3.0-canary.73).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

cacheComponents, Error Handling

Which stage(s) are affected? (Select all that apply)

next start (local)

Additional context

This can only be replicated using next build + next start.

next dev returns the correct status code on first render.

I have not tested this deployed to Vercel, it only came up as it's not passing our internal e2e tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Error HandlingRelated to handling errors (e.g., error.tsx, global-error.tsx).

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions