AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Turbopack Crashes In Pages/_App.Tsx When Next/Font Is Imported

Turbopack incorrectly reports 'Global CSS cannot be imported from files other than your Custom <App>' when pages/_app.tsx imports both a global CSS file and a font from next/font/google, even though _app.tsx is the custom app. The issue occurs only with the combination; removing either import resolves the error.

highConfidence 75%Next.jsPages RouterServer ActionsAffected V16.2.4Affected V16.3.0-Canary.2

Origin Analysis

Turbopack's global CSS import validation misclassifies the custom _app module when it contains an import from next/font. The presence of the font import likely triggers a transformation or module splitting that causes the global CSS import to be attributed to a different internal module, so the validation rule no longer recognizes the file as the custom App. This is a defect in Turbopack's module classification for global CSS imports when next/font is used.
1. Create pages/_app.tsx with import '../styles/globals.css' and import { Geist_Mono } from 'next/font/google' and use the font. 2. Run next build --turbopack or next dev --turbopack. 3. Observe the error 'Global CSS cannot be imported from files other than your Custom <App>'.

Fixing Code Block

Edge Case Audit

This is a workaround, not an official fix. The underlying Turbopack bug persists and may resurface if next/font is later imported directly in a file that also imports global CSS. The workaround is simple and should not introduce side effects, but it slightly changes code organization. For rollback, simply revert the changes and wait for a patched Next.js version. The workaround is stable in concurrent and multi-threaded build environments because it only involves module splitting.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state