vercel/next.js · error · Error
Route ${workStore.route} used `unstable_prefetch()`, which r
Error message
Route ${workStore.route} used `unstable_prefetch()`, which requires Cache Components to be enabled. Learn more: https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents What it means
Error "Route ${workStore.route} used `unstable_prefetch()`, which requires Cache Components to be enabled. Learn more: https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents" thrown in vercel/next.js.
Source
Thrown at packages/next/src/server/request/cache-stages.ts:37
* a prefetch (i.e. when using `<Link prefetch={true}>`) or a navigation.
*
* It has no effect during static prerendering — static output is computed
* once and shared across many clients, so there's no per-request cost to
* save — and no effect on the initial load of a page.
*
* Unlike `connection()`, it does not mark the subtree as request-dependent —
* content below `await unstable_prefetch()` remains fully cacheable.
*/
export function unstable_prefetch(): Promise<void> {
const workStore = workAsyncStorage.getStore()
const workUnitStore = workUnitAsyncStorage.getStore()
if (!workStore || !workUnitStore) {
const callingExpression = 'unstable_prefetch'
throwForMissingRequestStore(callingExpression)
}
if (!process.env.__NEXT_CACHE_COMPONENTS) {
throw new Error(
`Route ${workStore.route} used \`unstable_prefetch()\`, which requires Cache Components to be enabled. Learn more: https://nextjs.org/docs/app/api-reference/config/next-config-js/cacheComponents`
)
}
if (!isRequestApiAllowedInCurrentPhase(workUnitStore)) {
throw new Error(
`Route ${workStore.route} used \`unstable_prefetch()\` inside \`after()\` while rendering. The \`unstable_prefetch()\` function is used to indicate the subsequent code must not run in the app shell, but \`after()\` executes after the request, so this function is not allowed in this scope. See more info here: https://nextjs.org/docs/app/api-reference/functions/after`
)
}
switch (workUnitStore.type) {
case 'prerender': {
// Content below `prefetch()` is excluded from the shell, but it's
// deliberately included in the static output (and thus in static
// prefetches), so we only delay it until the static prefetch stage.
const { stagedRendering } = workUnitStore
if (!stagedRendering) {
// Prospective prerenderView on GitHub (pinned to 258b1c1bc0)
Solutions
- Enable Cache Components by setting experimental.cacheComponents: true in next.config.js (the __NEXT_CACHE_COMPONENTS flag this guard checks)
- Remove the unstable_prefetch() call from the route
- If you only need to defer work out of the app shell, check whether the cacheComponents-less alternative connection() fits, or upgrade to a configuration that supports prefetching
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at packages/next/src/server/request/cache-stages.ts:36 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of vercel/next.js@258b1c1bc0 (2026-08-21).
Data as JSON: /api/errors/25d92af49ee7f2bb.
Report an issue: GitHub.