Skip to content

Commit b58616b

Browse files
fix: mention params and searchParams in blocking-route error messages (#92360)
### What? Adds `params` and `searchParams` to the Dynamic variant of the blocking-route error message. ### Why? When `const { id } = await params` in a Page component triggers the blocking-route error, the message says "Uncached data or `connection()` was accessed outside of `<Suspense>`" — which doesn't mention `params` at all. This makes it hard for developers and AI agents to connect the error to `await params` being the cause, or to find the "Params and SearchParams" fix section in the linked error doc. ### How? Updated two error message strings in `dynamic-rendering.ts` (and the corresponding `errors.json` entry) to include `params` and `searchParams` alongside "Uncached data" and `connection()`. ## PR checklist (Fixing a bug) - Errors have a helpful link attached: https://nextjs.org/docs/messages/blocking-route Made with [Cursor](https://cursor.com)
1 parent aced0cf commit b58616b

File tree

9 files changed

+77
-77
lines changed

9 files changed

+77
-77
lines changed

packages/next/errors.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1082,7 +1082,7 @@
10821082
"1081": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateViewport\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport",
10831083
"1082": "Route \"%s\": Could not validate \\`unstable_instant\\` because a Client Component in a parent segment prevented the page from rendering.",
10841084
"1083": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
1085-
"1084": "Route \"%s\": Uncached data or \\`connection()\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
1085+
"1084": "Route \"%s\": Uncached data, \\`params\\`, \\`searchParams\\`, or \\`connection()\\` was accessed outside of \\`<Suspense>\\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route",
10861086
"1085": "Route \"%s\": Runtime data such as \\`cookies()\\`, \\`headers()\\`, \\`params\\`, or \\`searchParams\\` was accessed inside \\`generateMetadata\\` or you have file-based metadata such as icons that depend on dynamic params segments. Except for this instance, the page would have been entirely prerenderable which may have been the intended behavior. See more info here: https://nextjs.org/docs/messages/next-prerender-dynamic-metadata",
10871087
"1086": "Route \"%s\": %s This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/next-prerender-dynamic-viewport",
10881088
"1087": "Failed to parse \"%s\":\\n%s%s",

packages/next/src/next-devtools/dev-overlay/container/errors.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ function BlockingPageLoadErrorDescription({
225225
Viewport metadata needs to be available on page load so accessing
226226
data that comes from a user Request while producing it prevents
227227
Next.js from prerendering an initial UI.
228-
<code>cookies()</code>, <code>headers()</code>, and{' '}
229-
<code>searchParams</code>, are examples of Runtime data that can
228+
<code>cookies()</code>, <code>headers()</code>, <code>params</code>,
229+
and <code>searchParams</code> are examples of Runtime data that can
230230
only come from a user request.
231231
</p>
232232
<h4>To fix this:</h4>
@@ -364,9 +364,9 @@ function BlockingPageLoadErrorDescription({
364364
<p>
365365
This delays the entire page from rendering, resulting in a slow user
366366
experience. Next.js uses this error to ensure your app loads instantly
367-
on every navigation. <code>cookies()</code>, <code>headers()</code>,
368-
and <code>searchParams</code>, are examples of Runtime data that can
369-
only come from a user request.
367+
on every navigation. <code>cookies()</code>, <code>headers()</code>,{' '}
368+
<code>params</code>, and <code>searchParams</code> are examples of
369+
Runtime data that can only come from a user request.
370370
</p>
371371
<h4>To fix this:</h4>
372372
<p className="nextjs__blocking_page_load_error_fix_option">

packages/next/src/server/app-render/dynamic-rendering.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ export function trackDynamicHoleInNavigation(
988988
const usageDescription =
989989
kind === DynamicHoleKind.Runtime
990990
? `Runtime data such as \`cookies()\`, \`headers()\`, \`params\`, or \`searchParams\` was accessed outside of \`<Suspense>\`.`
991-
: `Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`.`
991+
: `Uncached data, \`params\`, \`searchParams\`, or \`connection()\` was accessed outside of \`<Suspense>\`.`
992992
const message = `Route "${workStore.route}": ${usageDescription} This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
993993
const error = addErrorContext(
994994
new Error(message),
@@ -1097,7 +1097,7 @@ export function trackDynamicHoleInRuntimeShell(
10971097
return
10981098
}
10991099

1100-
const message = `Route "${workStore.route}": Uncached data or \`connection()\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
1100+
const message = `Route "${workStore.route}": Uncached data, \`params\`, \`searchParams\`, or \`connection()\` was accessed outside of \`<Suspense>\`. This delays the entire page from rendering, resulting in a slow user experience. Learn more: https://nextjs.org/docs/messages/blocking-route`
11011101
const error = addErrorContext(new Error(message), componentStack, null)
11021102
dynamicValidation.dynamicErrors.push(error)
11031103
return

test/development/app-dir/cache-components-dev-fallback-validation/cache-components-dev-fallback-validation.test.ts

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ describe('Cache Components Fallback Validation', () => {
5555
"code": "E1083",
5656
"description": "Runtime data was accessed outside of <Suspense>
5757
58-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
58+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
5959
6060
To fix this:
6161
@@ -84,7 +84,7 @@ describe('Cache Components Fallback Validation', () => {
8484
"code": "E1083",
8585
"description": "Runtime data was accessed outside of <Suspense>
8686
87-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
87+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
8888
8989
To fix this:
9090
@@ -116,7 +116,7 @@ describe('Cache Components Fallback Validation', () => {
116116
"code": "E1083",
117117
"description": "Runtime data was accessed outside of <Suspense>
118118
119-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
119+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
120120
121121
To fix this:
122122
@@ -145,7 +145,7 @@ describe('Cache Components Fallback Validation', () => {
145145
"code": "E1083",
146146
"description": "Runtime data was accessed outside of <Suspense>
147147
148-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
148+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
149149
150150
To fix this:
151151
@@ -177,7 +177,7 @@ describe('Cache Components Fallback Validation', () => {
177177
"code": "E1083",
178178
"description": "Runtime data was accessed outside of <Suspense>
179179
180-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
180+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
181181
182182
To fix this:
183183
@@ -206,7 +206,7 @@ describe('Cache Components Fallback Validation', () => {
206206
"code": "E1083",
207207
"description": "Runtime data was accessed outside of <Suspense>
208208
209-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
209+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
210210
211211
To fix this:
212212
@@ -242,7 +242,7 @@ describe('Cache Components Fallback Validation', () => {
242242
"code": "E1083",
243243
"description": "Runtime data was accessed outside of <Suspense>
244244
245-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
245+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
246246
247247
To fix this:
248248
@@ -271,7 +271,7 @@ describe('Cache Components Fallback Validation', () => {
271271
"code": "E1083",
272272
"description": "Runtime data was accessed outside of <Suspense>
273273
274-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
274+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
275275
276276
To fix this:
277277
@@ -303,7 +303,7 @@ describe('Cache Components Fallback Validation', () => {
303303
"code": "E1083",
304304
"description": "Runtime data was accessed outside of <Suspense>
305305
306-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
306+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
307307
308308
To fix this:
309309
@@ -332,7 +332,7 @@ describe('Cache Components Fallback Validation', () => {
332332
"code": "E1083",
333333
"description": "Runtime data was accessed outside of <Suspense>
334334
335-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
335+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
336336
337337
To fix this:
338338
@@ -364,7 +364,7 @@ describe('Cache Components Fallback Validation', () => {
364364
"code": "E1083",
365365
"description": "Runtime data was accessed outside of <Suspense>
366366
367-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
367+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
368368
369369
To fix this:
370370
@@ -393,7 +393,7 @@ describe('Cache Components Fallback Validation', () => {
393393
"code": "E1083",
394394
"description": "Runtime data was accessed outside of <Suspense>
395395
396-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
396+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
397397
398398
To fix this:
399399
@@ -425,7 +425,7 @@ describe('Cache Components Fallback Validation', () => {
425425
"code": "E1083",
426426
"description": "Runtime data was accessed outside of <Suspense>
427427
428-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
428+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
429429
430430
To fix this:
431431
@@ -454,7 +454,7 @@ describe('Cache Components Fallback Validation', () => {
454454
"code": "E1083",
455455
"description": "Runtime data was accessed outside of <Suspense>
456456
457-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
457+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
458458
459459
To fix this:
460460
@@ -486,7 +486,7 @@ describe('Cache Components Fallback Validation', () => {
486486
"code": "E1083",
487487
"description": "Runtime data was accessed outside of <Suspense>
488488
489-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
489+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
490490
491491
To fix this:
492492
@@ -515,7 +515,7 @@ describe('Cache Components Fallback Validation', () => {
515515
"code": "E1083",
516516
"description": "Runtime data was accessed outside of <Suspense>
517517
518-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
518+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
519519
520520
To fix this:
521521
@@ -547,7 +547,7 @@ describe('Cache Components Fallback Validation', () => {
547547
"code": "E1083",
548548
"description": "Runtime data was accessed outside of <Suspense>
549549
550-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
550+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
551551
552552
To fix this:
553553
@@ -576,7 +576,7 @@ describe('Cache Components Fallback Validation', () => {
576576
"code": "E1083",
577577
"description": "Runtime data was accessed outside of <Suspense>
578578
579-
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), and searchParams, are examples of Runtime data that can only come from a user request.
579+
This delays the entire page from rendering, resulting in a slow user experience. Next.js uses this error to ensure your app loads instantly on every navigation. cookies(), headers(), params, and searchParams are examples of Runtime data that can only come from a user request.
580580
581581
To fix this:
582582

0 commit comments

Comments
 (0)