Repository navigation
Description
Which project does this relate to?
Start
Describe the bug
TanStack Start SSR build consistently fails with a stack overflow error in the CSS manifest plugin's getCSSRecursively function. The client build works perfectly, but the SSR step fails every time.
Your Example Website or App
localhost/unfortunately as cannot build
Steps to Reproduce the Bug or Issue
vite v7.1.5 building SSR bundle for production...
✓ 19 modules transformed.
✗ Build failed in 539ms
error during build:
[tanstack-start:start-manifest-plugin] Could not load tanstack-start-manifest:v (imported by node_modules/.pnpm/@TanStack[email protected]/node_modules/@tanstack/start-server-core/dist/esm/loadVirtualModule.js): Maximum call stack size exceeded
at getCSSRecursively (file:///path/to/node_modules/@tanstack/start-plugin-core/dist/esm/start-manifest-plugin/plugin.js:8:18)
at getCSSRecursively (file:///path/to/node_modules/@tanstack/start-plugin-core/dist/esm/start-manifest-plugin/plugin.js:23:12)
[... infinite recursion continues ...]
Expected behavior
Expected Behavior
The SSR build should complete successfully, generating both client and server bundles.
Actual Behavior
The SSR build fails with infinite recursion in the CSS manifest plugin, while the client build works perfectly.
Workaround
Currently using client-side only build:
Screenshots or Videos
No response
Platform
Node.js: 22.19.0 (also tested with 22.11.0)
TanStack Start: 1.131.44 (also tested with 1.131.36, 1.120.0)
Vite: 7.1.5
Package Manager: pnpm
OS: macOS
{
"dependencies": {
"@tanstack/react-start": "^1.131.44",
"@tanstack/react-router": "^1.131.44",
"@tanstack/react-router-devtools": "^1.131.44",
"@tanstack/react-router-ssr-query": "^1.131.44",
"@tailwindcss/vite": "^4.0.0-beta.7",
"tailwindcss": "^4.0.0-beta.7"
}
}
Additional context
Key Findings
The issue occurs even with NO CSS imports - suggesting it's not caused by our CSS files
Client build always works - the issue is specific to SSR manifest generation
The error is in TanStack Start's core CSS processing - not our application code
Multiple versions affected - this appears to be a persistent bug
Questions
Is this a known issue with TanStack Start's CSS manifest plugin?
Are there any configuration options to disable or fix the CSS recursion detection?
Is there a way to bypass the CSS manifest generation for SSR builds?
What's the recommended approach for complex CSS setups with TanStack Start?
Additional Context
This issue started appearing after working with a branding system that generates dynamic CSS with @import statements for Google Fonts. However, the issue persists even when all dynamic CSS generation and imports are completely disabled, suggesting the problem is in TanStack Start's core CSS processing logic rather than our application code.
Activity
bhouston commentedon Sep 22, 2025
I am also getting this error:
My setup:
schiller-manuel commentedon Sep 22, 2025
please provide complete minimal reproducers for this
spipov commentedon Oct 10, 2025
TanStack Start CSS Recursion Bug Report
Summary
pnpm buildfails during SSR bundle generation with "Maximum call stack size exceeded" error ingetCSSRecursivelyfunction. The client build completes successfully - only the SSR bundle fails.Environment
Package Versions
{ "@tanstack/react-router": "^1.131.36", "@tanstack/react-router-devtools": "^1.131.36", "@tanstack/react-router-ssr-query": "^1.131.36", "@tanstack/react-start": "^1.131.36", "@tanstack/router-plugin": "^1.131.36", "@tanstack/start-plugin-core": "1.131.36" }Node & Package Manager
node --version)pnpm --version)Build Tool
Error Details
Full Error Stack Trace
Error Location
@tanstack/start-plugin-core/dist/esm/start-manifest-plugin/plugin.jsgetCSSRecursivelyProblematic Code
From the plugin source at line 6-27:
Root Cause Analysis
The
getCSSRecursivelyfunction recursively traverses chunk imports to collect CSS files. The function lacks cycle detection, causing infinite recursion when:Why This Happens
chunk.importsand recursively processes each imported chunkBuild Behavior
✅ Client Build: SUCCESS
❌ SSR Build: FAILURE
Investigation Results
No Circular Dependencies in Client Manifest
Analyzed
.tanstack/start/build/client-dist/.vite/manifest.json:SSR Build Fails Before Manifest Creation
getCSSRecursivelyfunction is called during the manifest plugin'sloadhookProject Context
CSS Setup
@tailwindcss/vitepluginsrc/app/styles/app.cssComponent Structure
Vite Configuration
Standard TanStack Start configuration with:
@tanstack/router-plugin/vite@tailwindcss/vitevitePluginNodePolyfillsReproduction
Steps to Reproduce
pnpm buildMinimal Reproduction
Unable to create minimal reproduction as the issue appears to be related to:
spipov commentedon Oct 15, 2025
any updates? this is limiting. project works, but there are FOUC and other glitches.
fix: cache css collection during build
bhouston commentedon Nov 10, 2025
@spipov I did a big refactor and the error went away. So it isn't blocking me anymore. I wonder if it was a result of a circular dependency in my TypeScript files?