Skip to content

EADDRINUSE error when trying to spin up multiple TanStack Start dev servers #292

@AJ-505

Description

@AJ-505

Which project does this relate to?

Start

Describe the bug

I was trying to start multiple dev servers and I got the following error:

node:events:486
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRINUSE: address already in use :::42069
    at Server.setupListenHandle [as _listen2] (node:net:1940:16)
    at listenInCluster (node:net:1997:12)
    at Server.listen (node:net:2102:7)
    at ServerEventBus.start ([project]/node_modules/.pnpm/@tanstack+devtools-event-bus@0.3.3/node_modules/@tanstack/devtools-event-bus/dist/esm/server/server.js:155:12)
    at BasicMinimalPluginContext.configureServer ([project]/node_modules/.pnpm/@tanstack+devtools-vite@0.3.12_vite@7.3.0_@types+node@22.19.3_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0_/node_modules/@tanstack/devtools-vite/dist/esm/plugin.js:52:15)
    at _createServer ([project]/node_modules/.pnpm/vite@7.3.0_@types+node@22.19.3_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0/node_modules/vite/dist/node/chunks/config.js:25602:97)
    at async CAC.<anonymous> ([project]/node_modules/.pnpm/vite@7.3.0_@types+node@22.19.3_jiti@2.6.1_lightningcss@1.30.2_tsx@4.21.0/node_modules/vite/dist/node/cli.js:572:18)
    Emitted 'error' event on Server instance at:
        at emitErrorNT (node:net:1976:8)
        at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
    code: 'EADDRINUSE',
    errno: -98,
    syscall: 'listen',
    address: '::',
    port: 42069
}

Node.js v25.2.1
 ELIFECYCLE  Command failed with exit code 1.

Your Example Website or App

https://github.com/AJ-505/serverbus-conflict-repro

Steps to Reproduce the Bug or Issue

  1. Clone the reproduction repository
  2. Install dependencies (pnpm install)
  3. Start dev server (pnpm dev)
  4. Open a new terminal tab/window, navigate to the project directory and start another server (pnpm dev again)
  5. Error occurs as shown above

Expected behavior

I expect multiple TanStack Start dev servers to run seamlessly in parallel.

Screenshots or Videos

No response

Platform

  • Router / Start Version: 1.132.0
  • OS: Linux - Ubuntu, via the Windows subsystem for Linux (WSL)
  • Browser: Google Chrome
  • Browser Version: 143.0.7499.110 (Official Build) (64-bit)
  • Bundler: Vite
  • Bundler Version: 7.1.7

Additional context

Note:

  • This conflict also occurs when trying to run dev servers for different TanStack Start projects. It does not have to be the same project.
  • Also, I used pnpm here, but I've confirmed that the issue persists regardless of the package manager being used (including bun).
  • Interestingly, while debugging, I noticed that the issue might be due to the devtools configuration in the vite config (from @tanstack/devtools-vite):
// vite.config.ts
const config = defineConfig({
  plugins: [
    // Commenting the next line makes the error go away
    devtools(),
    // other configs
  ]
})

I appreciate the work you guys put in at the TanStack Start team to give us great tools with a great developer experience. Thank you so much.

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