Skip to content

serverFn.url used as a form action throws "forgot to return a response from your server route handler" #7745

Description

@sprucepad

Which project does this relate to?

Start

Describe the bug

When calling a server function directly, it works fine, but when calling a server function through .url (e.g. in a form action), it gives an HTTPError (full paths censored):

Error: It looks like you forgot to return a response from your server route handler. If you want to defer to the app router, make sure to have a component set in this route.
    at throwRouteHandlerError (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:187:9)
    ... 5 lines matching cause stack trace ...
    at async file://.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_d72b1ab9da4814157965ad4aab276fbb/node_modules/@tanstack/start-plugin-core/dist/esm/vite/dev-server-plugin/plugin.js:79:36 {
  cause: Error: It looks like you forgot to return a response from your server route handler. If you want to defer to the app router, make sure to have a component set in this route.
      at throwRouteHandlerError (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:187:9)
      at getFinalResponse (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:257:7)
      at executeMiddleware (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:325:33)
      at process.processTicksAndRejections (node:internal/process/task_queues:104:5)
      at async startRequestResolver (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected]_/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:524:50)
      at async Object.fetch (.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected][email protected][email protected][email protected]_react-dom@19._13289cfff4aadcbbf2e856a5b2ef2e8e/node_modules/@tanstack/react-start/dist/plugin/default-entry/server.ts:16:14)
      at async file://.../tanstack-http-error-repro/node_modules/.pnpm/@[email protected]_@[email protected][email protected]_r_d72b1ab9da4814157965ad4aab276fbb/node_modules/@tanstack/start-plugin-core/dist/esm/vite/dev-server-plugin/plugin.js:79:36,
  status: 500,
  statusText: undefined,
  headers: undefined,
  data: undefined,
  body: undefined,
  unhandled: true
}

Complete minimal reproducer

https://github.com/sprucepad/tanstack-http-error-repro

Steps to Reproduce the Bug

  1. Run pnpm install && pnpm run dev
  2. Go to localhost:3000, localhost:3001 and localhost:3002
  3. Click the "Through button" buttons in each, see the logs
  4. Click the "Through form" buttons in each, see the errors and logs

Expected behavior

I expected testFn.url to work for forms, as that's what's listed in the docs. Instead, I get an HTTP error.

Screenshots or Videos

repro.mp4

Platform

  • Router / Start Version: Start 1.168.27, Router 1.170.17 (from the template)
  • OS:Linux
  • Browser: Zen (Firefox)
  • Browser Version: 1.21.4b (Firefox 152.0.3)
  • Bundler: Vite
  • Bundler Version: 8.0.0

Additional context

No response

Activity

  1. sprucepad commented on Jul 8, 2026

    @sprucepad
    Author

    to work around this at the moment, you need to always return a Response from the server function if you ever use it as a form. (if this is intentional, then the docs need to be updated -- they say returning anything serializable works in all cases.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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