Skip to content

TanStack Start SSR Build Fails with "Maximum call stack size exceeded" in CSS Manifest Plugin #5166

@spipov

Description

@spipov

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+start-server-core@1.131.36/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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions