{"id":"8cd0d6efe46db585","repo":"vitest-dev/vitest","slug":"pool-context-pool-cannot-run-with-experiment","errorCode":null,"errorMessage":"Pool \"${context.pool}\" cannot run with \"experimental.viteModuleRunner: false\". Please, use \"threads\" or \"forks\" instead.","messagePattern":"Pool \"(.+?)\" cannot run with \"experimental\\.viteModuleRunner: false\"\\. Please, use \"threads\" or \"forks\" instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/runtime/workers/vm.ts","lineNumber":179,"sourceCode":"    await run(\n      method,\n      ctx.files,\n      ctx.config,\n      moduleRunner,\n      traces,\n    )\n  }\n  finally {\n    await traces.$(\n      'vitest.runtime.environment.teardown',\n      () => vm.teardown?.(),\n    )\n  }\n}\n\nexport function setupVmWorker(context: WorkerSetupContext): void {\n  if (context.config.experimental.viteModuleRunner === false) {\n    throw new Error(`Pool \"${context.pool}\" cannot run with \"experimental.viteModuleRunner: false\". Please, use \"threads\" or \"forks\" instead.`)\n  }\n}\n","sourceCodeStart":161,"sourceCodeEnd":182,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/runtime/workers/vm.ts#L161-L182","documentation":"setupVmWorker (vm.ts:177-180) refuses to start a VM pool when config.experimental.viteModuleRunner is false. The VM pool fundamentally relies on Vite's module runner to import the test entry inside the VM context, so the combination is unsupported; the error tells the user to switch to 'threads' or 'forks'.","triggerScenarios":"Configuring both pool: 'vmThreads' (or 'vmForks') and experimental.viteModuleRunner: false in the same project. The guard runs at worker setup before any test executes.","commonSituations":"Opting into the native module runner (viteModuleRunner: false) for performance/Node-native imports but forgetting to also change the pool away from vm*; copying config snippets that combine incompatible experimental flags.","solutions":["Set pool to 'threads' or 'forks' when using experimental.viteModuleRunner: false.","Or remove experimental.viteModuleRunner: false to keep using a VM pool."],"exampleFix":"// before: incompatible combination\nexport default defineConfig({\n  test: {\n    pool: 'vmThreads',\n    experimental: { viteModuleRunner: false },\n  },\n})\n\n// after: pick one\nexport default defineConfig({\n  test: {\n    pool: 'threads',\n    experimental: { viteModuleRunner: false },\n  },\n})","handlingStrategy":"validation","validationCode":"function assertPoolRunnerCompatibility(pool: string, viteModuleRunner: boolean | undefined) {\n  const isVmPool = pool === 'vmThreads' || pool === 'vmForks'\n  if (isVmPool && viteModuleRunner === false) {\n    throw new Error(\n      `Pool '${pool}' requires experimental.viteModuleRunner !== false. Use 'threads' or 'forks'.`\n    )\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Treat viteModuleRunner:false as compatible only with threads/forks pools.","Add a config validator in CI that rejects vm* pools combined with viteModuleRunner:false.","Document the experimental flag combinations in the project's config."],"tags":["vm-pool","config","vite-module-runner","incompatible-flags"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}