Skip to content

fix: silence NoFallbackError in router-server outer catch#90554

Open
sleitor wants to merge 1 commit intovercel:canaryfrom
sleitor:fix/no-fallback-error-console-log
Open

fix: silence NoFallbackError in router-server outer catch#90554
sleitor wants to merge 1 commit intovercel:canaryfrom
sleitor:fix/no-fallback-error-console-log

Conversation

@sleitor
Copy link

@sleitor sleitor commented Feb 26, 2026

What?

Prevent NoFallbackError from being logged via console.error in the outer catch block of router-server.ts, and treat it as a 404 (not a 500).

Why?

NoFallbackError is internal control-flow — thrown by dynamicParams = false routes when an unknown param is requested. It is caught and handled inside handleRequest (correctly producing a 404 response), but in edge cases (e.g. when the not-found page itself triggers the error) it can propagate to the outer catch block.

Previously, the outer catch logged it via console.error and attempted to serve a 500 response. This causes:

  • False-positive APM alerts — Datadog dd-trace, Sentry, New Relic, and similar tools intercept console.error and report every bot crawl of a dynamicParams = false route as an application error.
  • Wrong HTTP status code — a NoFallbackError is semantically a 404, not a 500.

How?

Added an else if (err instanceof NoFallbackError) branch before the console.error call. When matched, it sets invokePath = '/404' and invokeStatus = '404' without logging.

Fixes #90537

NoFallbackError is internal control-flow used by dynamicParams=false routes
to signal that an unknown param has no static rendering. It is caught and
handled inside handleRequest (producing the correct 404 response), but in
some edge cases (e.g. when the not-found page itself triggers the error) it
can propagate to the outer catch block where it was previously logged via
console.error and served as a 500.

This produces false-positive error alerts in APM tools (Datadog dd-trace,
Sentry, New Relic) that intercept console.error, flooding dashboards with
noise on every bot crawl of a dynamicParams=false route.

Fix: treat NoFallbackError in the outer catch as a 404 (not 500) and skip
the console.error call, since it is not a real application error.

Fixes vercel#90537
@nextjs-bot
Copy link
Collaborator

Allow CI Workflow Run

  • approve CI run for commit: ad29241

Note: this should only be enabled once the PR is ready to go and can only be enabled by a maintainer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NoFallbackError logged to console.error when dynamicParams = false rejects a param

2 participants