The symptom was as blunt as it gets: npm run dev started, reported ready in 324 ms, and then answered 500 on every route. npm run build succeeded. The deployed site was fine. Only the thing developers actually run was broken.
The terminal was not the log
The terminal showed a tail of a much longer story. The real record was in .next/dev/logs/next-development.log — 271 error entries, all of them one shape:
01Module not found: Can't resolve02 '@vercel/turbopack-next/internal/font/google/font'03 → [next]/internal/font/google/jetbrains_mono_*.module.css:7:804 05⚠ Received response with status 404 when requesting06 https://fonts.gstatic.com/s/jetbrainsmono/v24/…knk-6nFg.woff2Two errors stacked on top of each other, and the second one is the cause. Reading only the first would have sent us into module resolution, which was working fine.
The chain
- We asked next/font for JetBrains Mono with weight: 400, 500, 600.
- JetBrains Mono is a variable font, so discrete weights make next/font fetch static instances instead — thirteen files rather than six.
- Those static-instance URLs were answering 404 at fonts.gstatic.com that day.
- A font file that fails to download becomes a module-resolution error in Turbopack, one per @font-face.
- The layout imports the font, so every route that uses the layout fails. Which is every route.
Why the build did not care
The build fetched the same family without trouble and shipped nineteen real @font-face rules. Dev and build do not take the same path to the same font, and only one of them was hitting the broken URLs. That is the uncomfortable part: our Playwright suite runs against a production build, which is the right default, and it therefore could not have caught this. It passed all thirty tests while the development server was unusable.
The part that made it hard to reproduce
Turbopack's persistent cache lives in .next/cache/turbopack and is shared by dev and build. Once a build had populated it, dev never needed to download anything and the symptom vanished. That is also why it appeared in the middle of a session rather than at the start: installing a package while the dev server was running cleared the cache out from under it, and the next compile had to fetch for real.
The change
01const jetbrains = JetBrains_Mono({02 subsets: ['latin', 'latin-ext'],03 variable: '--font-jetbrains',04 display: 'swap',05- weight: ['400', '500', '600'],06})Removing three characters of configuration. The variable file covers 100 to 800, so every weight the design uses still works, from six files instead of thirteen, with no dependency on static-instance URLs that can rotate upstream. Inter had been configured that way from the start and never broke once.
What we added
A second check that boots the development server and asserts every route renders and the compiler reports no module or fetch errors. It runs in about twenty seconds and it covers the gap the production-build suite structurally cannot.
If your tests only exercise the production build, they cannot tell you whether anyone can run the app.
Google stopped serving those 404s a few hours later, which means we can no longer reproduce the failure to prove the fix. We kept the change anyway: it is the configuration that never broke, it is smaller, and it removes a dependency on someone else’s file names.
Tags
- Next.js
- Turbopack
- Debugging