Skip to content

v4: Timeout starting forks runner. #8968

Closed

Description

@lfantone

Describe the bug

After upgrading to Vitest 4 our test started to fail randomly with:

Error: [vitest-pool]: Timeout starting forks runner.

Image

The project is a monorepo with 25 different packages. The test are being orchestrated with turborepo

The failures not only happens on my local but also in our CI workflows.

The vite config in use is:

{
  plugins: [
    react(),
    babel({
      filter: /\.[jt]sx?$/,
      babelConfig: {
        presets: ['@babel/preset-typescript'],
        plugins: ['@babel/plugin-syntax-jsx', ['babel-plugin-react-compiler', { target: '19' }]],
      },
    }),
    vanillaExtractPlugin(),
    tsconfigPaths(),
  ],
  test: {
    bail: 3,
    logHeapUsage: true,
    include: [ '**/*.test.*' ],
    exclude: [
      '**/node_modules',
      '**/coverage',
      '**/build',
      '**/dist',
      '**/types'
    ],
    setupFiles: [ './vitest.setup.js' ],
    coverage: {
      provider: 'v8',
      clean: true,
      include: ['**/app/**/*.{js,ts,jsx,tsx}', '**/components/**/*.{js,ts,jsx,tsx}'],
      allowExternal: false,
      exclude: ['**/node_modules', '**/coverage', '**/build', '**/dist', '**/types', '**/*.css'],
    },
    environment: 'happy-dom'
  }
}

Everything was running fine in v3.

Reproduction

https://github.com/lfantone/vitest-threads-error

System Info

System:
    OS: macOS 26.0.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.44 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.21.0 - /Users/lfantone/.volta/tools/image/node/22.21.0/bin/node
    Yarn: 4.10.3 - /Users/lfantone/.volta/tools/image/yarn/3.8.3/bin/yarn
    npm: 10.9.4 - /Users/lfantone/.volta/tools/image/node/22.21.0/bin/npm
  Browsers:
    Chrome: 142.0.7444.60
    Safari: 26.0.1

Used Package Manager

yarn

Validations

Activity

  1. added theissue type on Nov 7, 2025
  2. changed the title [-]Error: [vitest-pool]: Timeout starting forks runner.[/-] [+]v4: Timeout starting forks runner.[/+] on Nov 7, 2025
  3. psyvision commented on Nov 7, 2025

    @psyvision

    vitese: 4.0.8, Windows 11 and have seen similar at the start of a test run and also at the end (after lots of successful tests):

    Image
  4. github-actions commented on Nov 7, 2025

    @github-actions
  5. lfantone commented on Nov 7, 2025

    @lfantone
    Author

    Edited the initial message to include a reproduction repository

  6. its2easy commented on Nov 7, 2025

    @its2easy

    As I mentioned here I started getting this error starting with [email protected]. That reproduction repo is also suitable for this error.

    With pool: 'forks':

    Error: [vitest-pool]: Timeout starting forks runner.
     ❯ Timeout._onTimeout node_modules/vitest/dist/chunks/cli-api.Csks4as1.js:6872:65
     ❯ listOnTimeout node:internal/timers:608:17
     ❯ processTimers node:internal/timers:543:7
    

    With pool: 'threads':

    Error: [vitest-pool]: Timeout starting threads runner.
     ❯ Timeout._onTimeout node_modules/vitest/dist/chunks/cli-api.Csks4as1.js:6872:65
     ❯ listOnTimeout node:internal/timers:608:17
     ❯ processTimers node:internal/timers:543:7
    

    vmForks and vmThreads are not affected.

    With my setup it fails the first time I run tests after I turn on Windows Defender, subsequent test runs work as usual. So to trigger it again I have to disable Defender, enable Defender, then the first run will trigger the error.

    With fileParallelism: false or maxWorkers: 1, insead of an error the 1st test file ends successfully and then the test process continues indefinitely, while the duration number increases.

  7. lfantone commented on Nov 7, 2025

    @lfantone
    Author

    In my case this is failing on a Github Action workflow under the ubuntu machine. There is no Windows Defender there.

    Everything works fine in [email protected], none of the v4 versions works for me.
    vmForks or vmThreads throws another errors.

    Unfortunately I cannot place the same setup as it's a private organisation 😢, but when running without turbo I faced another kind of errors:

    ⎯⎯⎯⎯⎯⎯ Failed Suites 1 ⎯⎯⎯⎯⎯⎯⎯
    
     FAIL  components/atoms/table/table.test.jsx [ components/atoms/table/table.test.jsx ]
    Error: "transformResult" in not defined. This is a bug in Vitest.
     ❯ components/atoms/table/table.css.ts:8:31
     ❯ components/atoms/table/table.test.jsx:4:1
    
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯

    After lot of tries, I manage to get all the test running by limiting the amount of maxConcurrency: 3 test and the setting the concurrency in turbo to 5

  8. AriPerkkio commented on Nov 7, 2025

    @AriPerkkio
    Member

    Edited the initial message to include a reproduction repository

    The reproduction is showing Not found 404, could you double-check that https://github.com/lfantone/vitest-threads-error is public?

  9. AriPerkkio commented on Nov 7, 2025

    @AriPerkkio
    Member

    Could you also verify if this error comes up with following versions:

    • 4.0.0-beta.19
    • 4.0.0-beta.18
    • 4.0.0-beta.5
    • 4.0.0-beta.4

    For example, npm install [email protected].

  10. github-actions commented on Nov 7, 2025

    @github-actions

    Hello @lfantone. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with needs reproduction will be closed if they have no activity within 3 days.

  11. lfantone commented on Nov 8, 2025

    @lfantone
    Author

    @AriPerkkio Sorry that, the repo is not public

  12. 17 remaining items

  13. AriPerkkio commented on Nov 13, 2025

    @AriPerkkio
    Member

    @jeremymeng does that error come up locally too? I've been running that project for a while now but cannot repro the error.

    There's another preview release to test out. Please try it out and report if it makes tests pass or stuck.

    As we don't have reproduction this is quite difficult to fix. If someone has project that runs into this issue, you can help all others by building minimal repro. 🙏

  14. psyvision commented on Nov 13, 2025

    @psyvision

    Will try that version tomorrow and let you know :) thanks

  15. Nttz commented on Nov 13, 2025

    @Nttz

    @AriPerkkio

    Hello!

    I think fix(forks): increase worker start timeout #9027 (comment) should help.

    We ran into a similar problem when trying to upgrade to version 4.
    We don't have turbo, but sometimes the test run fails with the same error as the author.
    This doesn't happen on every run, so it seems to depend on the load of th e system and how the tests are started.
    For example, adding jsdom to environments increases the startup time by an average of 650ms.

    I tried to reproduce this issue, but to do so, I had to slow down the initialization of forks:
    https://github.com/Nttz/vitest-forks-error-reproduction/tree/main

    I also checked similar code on version 3.2.4, and it didn't reproduce.
    https://github.com/Nttz/vitest-forks-error-reproduction/tree/v3-test-fail

    I hope this helps with the further investigation.

  16. TheJaredWilcurt commented on Nov 13, 2025

    @TheJaredWilcurt
    Contributor

    Happens in my public repo (and my private work ones):

    On cmd.exe, powershell.exe and the git-bash terminal the tests start running, then after a few pass it just freezes and never finishes. In Windows Terminal (cmd tab), it does not freeze, but when it ends it has the same errors shown by others.

    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    
    Vitest caught 10 unhandled errors during the test run.
    This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.
    
    ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Error ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
    Error: [vitest-pool]: Timeout starting forks runner.
     ❯ Timeout.<anonymous> node_modules/vitest/dist/chunks/cli-api.BQ-bjcRi.js:7235:65
     ❯ listOnTimeout node:internal/timers:605:17
     ❯ processTimers node:internal/timers:541:7
    
    • Windows 11
    • Node 24
    • Node 25
    • Vitest 4.0.8
  17. heath-freenome commented on Nov 13, 2025

    @heath-freenome

    I started seeing this when I upgraded to Node 24... Not sure if that helps. I was using pools: 'threads'. When I switched to vmThreads the exception didn't happen

  18. added
    p4-important
    and removed on Nov 14, 2025
  19. psyvision commented on Nov 14, 2025

    @psyvision

    4.0.9 resolved this for me. Many thanks!

  20. its2easy commented on Nov 14, 2025

    @its2easy

    4.0.9 fixed the problem with my ms defender case

  21. devdumpling commented on Nov 14, 2025

    @devdumpling

    Resolved for us as well, thanks!

  22. csenk commented on Nov 15, 2025

    @csenk

    It seems like 4.0.9 solves this issue for us as well.
    Before I saw this I build a minimal reproduction repository were the issue is happening all the time. It might help although the issue is resolved: https://github.com/csenk/vitest-issues-8968-reproduction

    For us the issue had nothing to do with Windows Defender as we developing on Macs and the CI is using ubuntu runners.

  23. locked and limited conversation to collaborators on Nov 30, 2025
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

    p4-important

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions