TanStack / TanStack/router

Start RSC mode: server functions imported only from 'use client' modules are missing from the production manifest ("Server function info not found")

Open
#7,943 4 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
15.1k
Forks
1.9k
Avg merge
1d 20h
Merged PRs (30d)
143

Description

Which project does this relate to?

Start

Describe the bug

With RSC mode enabled (tanstackStart({ rsc: { enabled: true } })), a module that declares a server function with createServerFn() but is only imported from a 'use client' module works in vite dev and fails in a production build at call time:

Error: Server function info not found for 4871320a42e02f1456100b5f8ab1447a1b455d58d8cdc316bd1cbe505ccd1e24
    at Module.getServerFnById (dist/server/rsc/index.js:2900:27)
    at getServerFnById (dist/server/assets/createServerFn-….js:133:61)
    at async handleServerAction (dist/server/server.js:10770:17)

The client bundle contains the RPC stub with the generated function ID, but the server-fn resolver manifest in the rsc output (dist/server/rsc/index.js) has no entry for that ID, so every invocation returns HTTP 500.

Server functions whose defining modules are also reachable from route files or server components are registered fine. Only the ones reachable exclusively through a 'use client' boundary are missing.

Building the same project with rsc: false produces a complete manifest, so this is specific to RSC mode.

Complete minimal reproducer

https://github.com/G4RDS/tanstack-router-7943-repro

Steps to Reproduce the Bug
git clone https://github.com/G4RDS/tanstack-router-7943-repro
cd tanstack-router-7943-repro
npm install
  1. npm run dev, open http://localhost:3000, click both buttons. Both succeed.
  2. npm run build && npm start, open http://localhost:3000.
  3. Click "Call getCount". It succeeds. This function is imported from the route file.
  4. Click "Call updateCount". HTTP 500, and the server logs Server function info not found for 4871320a…. This function is imported only from Counter.tsx, which is a 'use client' component.

It can also be verified without starting the server:

$ grep -o 'functionName: "[^"]*"' dist/server/rsc/index.js
functionName: "getCountServerFn_createServerFn_handler"
functionName: "getPage_createServerFn_handler"
# updateCountServerFn_createServerFn_handler is missing

$ grep -oh '[0-9a-f]\{64\}' dist/client/assets/*.js | sort -u | wc -l
3   # the client bundle references all three IDs, including the missing one
Expected behavior

Server functions referenced only from 'use client' modules should be registered in the production manifest, so that calling them in a production build behaves the same as in dev.

Platform
  • Router / Start Version: @tanstack/react-start 1.168.40, @tanstack/react-router 1.170.23
  • OS: macOS (darwin 25.5.0)
  • Browser: Chrome
  • Bundler: vite
  • Bundler Version: vite 8.2.1, @vitejs/plugin-rsc 0.5.34

Transitive Start packages, for reference: @tanstack/start-plugin-core 1.171.31, @tanstack/start-client-core 1.170.19, @tanstack/start-server-core 1.169.23. Node 22.15.1.

Additional context

The 500 is not observable from application code. The call does not reject, it resolves with undefined, so a try/catch around it never runs:

try {
  const res = await updateCount({ data: { addBy: 1 } })
  setResult(JSON.stringify(res)) // res is undefined, so this sets undefined
} catch (err) {
  // never reached
  setResult(`ERROR: ${err instanceof Error ? err.message : String(err)}`)
}

The response for the failing call is {"status":500,"unhandled":true,"message":"HTTPError"} with content-type: application/json. The Server function info not found message appears only in the server log.

Errors thrown inside a server function handler do reject on the client as expected, so this seems limited to this failure.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Clone and run the linked minimal reproducer, then compare the production outputs in dist/server/rsc/index.js and dist/client/assets/*.js. Start by tracing why the client-referenced updateCount ID is absent from the RSC manifest while route-reachable functions are present. Done means the client-only server function is registered and its production call succeeds, matching dev and rsc:false behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript, vite
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.