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

Tailwind V4 Persistent Cache Stuck On CSS Syntax Errors In Next.Js Dev (Turbopack & Monorepo)

When a CSS file (especially referenced via @reference or @import across packages) contains a syntax error, Next.js caches the error state. After fixing the syntax error, the dev server continues serving the cached error, requiring manual deletion of .next and restart. The issue occurs with both Turbopack and Webpack, and is more severe in monorepos.

highConfidence 85%Next.jsPages RouterTurbopackApp RouterAffected V15.xAffected V16.x

Origin Analysis

Next.js/Turbopack's CSS compilation pipeline does not properly invalidate cached error states when a CSS file that previously caused a syntax error is fixed. The dependency graph, particularly for cross-package @reference or @import links, fails to trigger a clean rebuild, leaving stale error overlays served from the .next cache.
1. Create a Next.js project with Tailwind v4 and enable Turbopack (or use Webpack). 2. In a CSS Module, use `@reference "../../app/globals.css";` (or in a monorepo, use `@import "@repo/ui/globals.css";` in app/globals.css). 3. Introduce a syntax error in the referenced CSS file (e.g., remove a closing brace). 4. Observe the compilation error in the browser. 5. Fix the syntax error in the source CSS file. 6. Notice the error persists even after refresh or server restart. 7. Only clearing the .next folder or switching bundler temporarily resolves it.

Fixing Code Block

Edge Case Audit

This script deletes the entire .next directory on every CSS change, causing a full rebuild and significantly slowing down development. It may also interrupt other file watchers or cause race conditions if multiple changes occur rapidly. Use only as a temporary measure; revert to the standard `next dev` command once an official fix is available. For production, this script should never be used.

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