Which project does this relate to?
Start
Describe the bug
When defaultSsr: false is set in start.ts, route-level ssr: true is completely ignored. The staticServerFnCache is not generated during build, causing a 404 in the browser:
GET /__tsr/staticServerFnCache/...json 404 (Not Found)
Unexpected token '<', "<!DOCTYPE "... is not valid JSON
Why this matters: We want 100% client-first (defaultSsr: false) with selective SSG on specific routes — no SSR at request time. This bug makes that architecture impossible.
TanStack promise: The TanStack Start homepage states:
[...] Client-Side First [...]
This promise of "client-side first" with selective server-side capabilities (SSG) is broken when defaultSsr: false prevents route-level SSG from working.
Your Example Website or App
https://github.com/fullheart/tanstack-start-issue-selective-ssg
Two projects: ssg-working/ (defaultSsr: true) vs ssg-not-working/ (defaultSsr: false).
Steps to Reproduce the Bug or Issue
git clone https://github.com/fullheart/tanstack-start-issue-selective-ssg.git
cd ssg-not-working && npm install && npm run build
- Check:
ls .output/public/__tsr/staticServerFnCache/ → directory does not exist
- Compare:
cd ../ssg-working && npm run build && ls .output/public/__tsr/staticServerFnCache/ → file exists
cd ../ssg-not-working && PORT=3011 npm run start
- Open
http://localhost:3011/ssg-page in browser → you will see "Something went wrong!" and in the console:
Failed to load resource: the server responded with a status of 404` for `__tsr/staticServerFnCache/*.json
SyntaxError: Unexpected token '<', "<!DOCTYPE "... is not valid JSON
Expected behavior
defaultSsr: false → client-first by default for all routes
ssr: true on a route → that route should prerender and generate staticServerFnCache at build time
- The
staticServerFnCache/*.json should exist for routes with ssr: true
What actually happens: defaultSsr: false prevents staticServerFnCache generation entirely. Route-level ssr: true is ignored.
Platform
- Start Version:
@tanstack/react-start@1.167.42
- Router Version:
@tanstack/react-router@1.168.23
- Static Server Functions:
@tanstack/start-static-server-functions@1.166.33
- OS: Linux
- Bundler: Vite 8.0.9
- Nitro: 3.0.1-20260422-085752-8c3f16b2
- Node: 24.14.0
Additional context
Architecture goal: Client-first SPA (like Vite) with selective SSG for content routes. No SSR at request time.
start.ts (broken):
export const startInstance = createStart(() => ({
defaultSsr: false
}));
ssg-page.tsx:
const fetchPost = createServerFn({ method: "GET" })
.middleware([staticFunctionMiddleware])
.handler(async () => {
const res = await fetch("https://jsonplaceholder.typicode.com/posts/1");
return await res.json();
});
export const Route = createFileRoute("/ssg-page")({
ssr: true,
beforeLoad: async () => {
const data = await fetchPost();
return { postData: data };
},
component: SsgPage
});
Workaround: Set defaultSsr: true globally, but this forces SSR on all routes and defeats the purpose.
Which project does this relate to?
Start
Describe the bug
When
defaultSsr: falseis set instart.ts, route-levelssr: trueis completely ignored. ThestaticServerFnCacheis not generated during build, causing a 404 in the browser:Why this matters: We want 100% client-first (
defaultSsr: false) with selective SSG on specific routes — no SSR at request time. This bug makes that architecture impossible.TanStack promise: The TanStack Start homepage states:
This promise of "client-side first" with selective server-side capabilities (SSG) is broken when
defaultSsr: falseprevents route-level SSG from working.Your Example Website or App
https://github.com/fullheart/tanstack-start-issue-selective-ssg
Two projects:
ssg-working/(defaultSsr: true) vsssg-not-working/(defaultSsr: false).Steps to Reproduce the Bug or Issue
git clone https://github.com/fullheart/tanstack-start-issue-selective-ssg.gitcd ssg-not-working && npm install && npm run buildls .output/public/__tsr/staticServerFnCache/→ directory does not existcd ../ssg-working && npm run build && ls .output/public/__tsr/staticServerFnCache/→ file existscd ../ssg-not-working && PORT=3011 npm run starthttp://localhost:3011/ssg-pagein browser → you will see "Something went wrong!" and in the console:Expected behavior
defaultSsr: false→ client-first by default for all routesssr: trueon a route → that route should prerender and generatestaticServerFnCacheat build timestaticServerFnCache/*.jsonshould exist for routes withssr: trueWhat actually happens:
defaultSsr: falsepreventsstaticServerFnCachegeneration entirely. Route-levelssr: trueis ignored.Platform
@tanstack/react-start@1.167.42@tanstack/react-router@1.168.23@tanstack/start-static-server-functions@1.166.33Additional context
Architecture goal: Client-first SPA (like Vite) with selective SSG for content routes. No SSR at request time.
start.ts (broken):
ssg-page.tsx:
Workaround: Set
defaultSsr: trueglobally, but this forces SSR on all routes and defeats the purpose.