Repository navigation
Labels
p4-importantViolate documented behavior or significantly improves performance (priority)
Description
Describe the bug
After upgrading to Vitest 4 our test started to fail randomly with:
Error: [vitest-pool]: Timeout starting forks runner.
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
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.1Used Package Manager
yarn
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
Reacted by Zac, Adrià Vilanova Martínez, MCMXC, Jacob ‘Jake’ Shirley, Nick Hester, Ewen Cumming, Marco, Alexandre Paradis, Grégory Houllier, Jeremy Möglich and 8 more
Reacted by hieuvuvan, Adrià Vilanova Martínez, MCMXC, Michael Flohr, Alexandre Paradis, Marco and Koen Calliauw
Metadata
Metadata
Assignees
Labels
p4-importantViolate documented behavior or significantly improves performance (priority)
Activity
[-]Error: [vitest-pool]: Timeout starting forks runner.[/-][+]v4: Timeout starting forks runner.[/+]psyvision commentedon Nov 7, 2025
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):github-actions commentedon Nov 7, 2025
lfantone commentedon Nov 7, 2025
Edited the initial message to include a reproduction repository
its2easy commentedon Nov 7, 2025
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':With
pool: 'threads':vmForksandvmThreadsare 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: falseormaxWorkers: 1, insead of an error the 1st test file ends successfully and then the test process continues indefinitely, while the duration number increases.lfantone commentedon Nov 7, 2025
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.
vmForksorvmThreadsthrows 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:
After lot of tries, I manage to get all the test running by limiting the amount of
maxConcurrency: 3test and the setting the concurrency in turbo to 5AriPerkkio commentedon Nov 7, 2025
The reproduction is showing Not found 404, could you double-check that https://github.com/lfantone/vitest-threads-error is public?
AriPerkkio commentedon Nov 7, 2025
Could you also verify if this error comes up with following versions:
4.0.0-beta.194.0.0-beta.184.0.0-beta.54.0.0-beta.4For example,
npm install [email protected].github-actions commentedon Nov 7, 2025
Hello @lfantone. Please provide a minimal reproduction using a GitHub repository or StackBlitz (you can also use examples). Issues marked with
needs reproductionwill be closed if they have no activity within 3 days.lfantone commentedon Nov 8, 2025
@AriPerkkio Sorry that, the repo is not public
17 remaining items
AriPerkkio commentedon Nov 13, 2025
@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. 🙏
psyvision commentedon Nov 13, 2025
Will try that version tomorrow and let you know :) thanks
Nttz commentedon Nov 13, 2025
@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.
TheJaredWilcurt commentedon Nov 13, 2025
Happens in my public repo (and my private work ones):
On
cmd.exe,powershell.exeand thegit-bashterminal 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.heath-freenome commentedon Nov 13, 2025
I started seeing this when I upgraded to Node 24... Not sure if that helps. I was using
pools: 'threads'. When I switched tovmThreadsthe exception didn't happenpsyvision commentedon Nov 14, 2025
4.0.9resolved this for me. Many thanks!its2easy commentedon Nov 14, 2025
4.0.9fixed the problem with my ms defender casedevdumpling commentedon Nov 14, 2025
Resolved for us as well, thanks!
csenk commentedon Nov 15, 2025
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.
hangup問題解消のため、vitestをアップグレード