nextjs - 💡(How to fix) Fix global-not-found breaks with any import (infinite dev loop, high CPU) in Next 16.2.x [2 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#92256Fetched 2026-04-08 02:32:41
View on GitHub
Comments
2
Participants
3
Timeline
4
Reactions
1
Timeline (top)
commented ×2issue_type_added ×1labeled ×1

Code Example

pnpm create next-app@latest

---

mkdir -p app/'(group1)' app/'(group2)'/path && \
   cp app/page.tsx app/'(group1)'/page.tsx && \
   cp app/layout.tsx app/'(group1)'/layout.tsx && \
   cp app/layout.tsx app/'(group2)'/layout.tsx && \
   cp app/page.tsx app/'(group2)'/path/page.tsx

---

rm app/page.tsx app/layout.tsx

---

export default {
     experimental: {
       globalNotFound: true,
     },
   }

---

import './globals.css';

   export default function GlobalNotFound() {
     return (
       <html lang="en">
         <body>
           <h1>404 - Page Not Found</h1>
           <p>This page does not exist.</p>
         </body>
       </html>
     );
   }

---

pnpm run dev

---

export default function GlobalNotFound() {
  return (
    <html lang="en">
      <body>
        <h1>404 - Page Not Found</h1>
        <p>This page does not exist.</p>
      </body>
    </html>
  );
}

---

Operating System:
  Platform: linux
  Arch: x64
  Version: #20~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 01:28:37 UTC 2
  Available memory (MB): 11851
  Available CPU cores: 4
Binaries:
  Node: 25.1.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.32.1
Relevant Packages:
  next: 16.2.2 // Latest available version is detected (16.2.2).
  eslint-config-next: N/A
  react: 19.2.4
  react-dom: 19.2.4
  typescript: 5.9.3
Next.js Config:
  output: N/A
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/intoRandom/next-global-not-found-import-bug

To Reproduce

  1. Create a new Next.js app:
   pnpm create next-app@latest
  1. Create route groups:
   mkdir -p app/'(group1)' app/'(group2)'/path && \
   cp app/page.tsx app/'(group1)'/page.tsx && \
   cp app/layout.tsx app/'(group1)'/layout.tsx && \
   cp app/layout.tsx app/'(group2)'/layout.tsx && \
   cp app/page.tsx app/'(group2)'/path/page.tsx
  1. Remove root layout and page:
   rm app/page.tsx app/layout.tsx
  1. Enable experimental flag in next.config.ts:
   export default {
     experimental: {
       globalNotFound: true,
     },
   }
  1. Create app/global-not-found.tsx with an import:
   import './globals.css';

   export default function GlobalNotFound() {
     return (
       <html lang="en">
         <body>
           <h1>404 - Page Not Found</h1>
           <p>This page does not exist.</p>
         </body>
       </html>
     );
   }
  1. Run:
   pnpm run dev

Current vs. Expected behavior

Expected:

  • global-not-found renders correctly
  • dev server remains stable

Actual:

  • Page fails to render correctly (blank or inconsistent)
  • Dev server enters an infinite loop
  • Multiple Node processes spawn
  • High CPU usage

Key finding: The issue is triggered by any import inside global-not-found.tsx.

Working version (no imports, same HTML structure):

export default function GlobalNotFound() {
  return (
    <html lang="en">
      <body>
        <h1>404 - Page Not Found</h1>
        <p>This page does not exist.</p>
      </body>
    </html>
  );
}
```tsx

### Provide environment information

```bash
Operating System:
  Platform: linux
  Arch: x64
  Version: #20~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Thu Mar 19 01:28:37 UTC 2
  Available memory (MB): 11851
  Available CPU cores: 4
Binaries:
  Node: 25.1.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.32.1
Relevant Packages:
  next: 16.2.2 // Latest available version is detected (16.2.2).
  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)

Not Found

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

next dev (local)

Additional context

  • The issue occurs even with minimal imports such as: import './globals.css';

  • The problem is not related to JSX structure. The same component works correctly when no imports are present.

  • Regression:

  • Likely related to how global-not-found is handled as a special entry in the module graph when no root layout is present.

  • Reproducible locally.

extent analysis

TL;DR

The issue can be temporarily worked around by removing imports from the global-not-found.tsx file or potentially downgrading to a version of Next.js that does not exhibit this behavior, such as [email protected].

Guidance

  • Identify and remove any imports from the global-not-found.tsx file to see if the issue resolves, as the problem is triggered by any import inside this file.
  • Consider downgrading Next.js to version 16.1.6, which is reported to work correctly, as a temporary solution until the issue is fixed in later versions.
  • Review the Next.js documentation and release notes for versions 16.2.1 and 16.2.2 to understand any changes related to global not found handling and module graph management.
  • If the issue persists, try to isolate the problem further by testing with different types of imports (e.g., CSS vs. JavaScript modules) to provide more detailed feedback.

Example

No specific code example is provided as the issue is more related to the configuration and versioning of Next.js rather than a specific code snippet that can be modified to fix the issue.

Notes

The solution provided is based on the information given in the issue and might not be applicable in all scenarios. The issue seems to be related to how Next.js handles the global-not-found page in versions 16.2.1 and 16.2.2, especially when there are imports present in the global-not-found.tsx file.

Recommendation

Apply a workaround by removing imports from the global-not-found.tsx file or downgrade to [email protected] until the issue is resolved in future versions of Next.js. This recommendation is based on the information provided that removing imports or using an earlier version of Next.js resolves the issue.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix global-not-found breaks with any import (infinite dev loop, high CPU) in Next 16.2.x [2 comments, 3 participants]