{"id":"f23d1b0662f3a124","repo":"vitest-dev/vitest","slug":"the-browser-server-was-not-initialized-project-na","errorCode":null,"errorMessage":"The browser server was not initialized${project.name ? ` for the \"${project.name}\" project` : ''}. This is a bug in Vitest. Please, open a new issue with reproduction.","messagePattern":"The browser server was not initialized(.+?)\" project` : ''\\}\\. This is a bug in Vitest\\. Please, open a new issue with reproduction\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/pools/browser.ts","lineNumber":95,"sourceCode":"        testLocations: testLines,\n        testIds,\n        testNamePattern,\n        testTagsFilter,\n        fileTags: testFileTags.get(spec),\n      })\n      groupedFiles.set(project, files)\n    }\n\n    let isCancelled = false\n    vitest.onCancel(() => {\n      isCancelled = true\n    })\n\n    const initialisedPools = await Promise.all(Array.from(groupedFiles.entries(), async ([project, files]) => {\n      await project._initBrowserProvider()\n\n      if (!project.browser) {\n        throw new TypeError(`The browser server was not initialized${project.name ? ` for the \"${project.name}\" project` : ''}. This is a bug in Vitest. Please, open a new issue with reproduction.`)\n      }\n\n      if (isCancelled) {\n        return\n      }\n\n      debug?.('provider is ready for %s project', project.name)\n\n      const pool = ensurePool(project)\n      vitest.state.clearFiles(project, files.map(f => f.filepath))\n      providers.add(project.browser!.provider)\n\n      return {\n        pool,\n        provider: project.browser!.provider,\n        runTests: () => pool.runTests(method, files),\n      }\n    }))","sourceCodeStart":77,"sourceCodeEnd":113,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/pools/browser.ts#L77-L113","documentation":"Internal assertion in the browser pool: after project._initBrowserProvider() resolves, project.browser must be set. If it is still falsy, browser provider initialization silently failed to populate the server reference, which the framework treats as a bug rather than a recoverable state.","triggerScenarios":"createBrowserPool -> runWorkspaceTests iterates groupedFiles per project, calls project._initBrowserProvider() at packages/vitest/src/node/pools/browser.ts:92, then checks project.browser at :94. If the provider init did not assign project.browser (a framework invariant), this throws.","commonSituations":"A custom browser provider that does not correctly initialize the server on the project; a regression in browser provider initialization across Vitest versions; browser.enabled in config but the provider failed to load and the error was swallowed before this assertion.","solutions":["Report as a Vitest bug with a minimal repro (config.browser configuration + provider).","Verify config.browser.provider is a supported value ('playwright', 'webdriverio') or a correctly implemented custom provider.","Ensure config.browser.enabled is true and the provider package is installed and importable.","Try a different built-in provider to isolate whether a custom provider is at fault."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Confirm browser provider loads before delegating to the pool\nconst project = vitest.projects.find(p => p.config.browser.enabled)\nawait project._initBrowserProvider()\nif (!project.browser) {\n  throw new Error('Browser provider failed to initialize; check provider config/install')\n}","typeGuard":null,"tryCatchPattern":"try {\n  await vitest.start()\n} catch (e) {\n  if (e.message.startsWith('The browser server was not initialized')) {\n    console.error('Browser provider init failed. Verify config.browser.provider is installed.')\n  }\n  throw e\n}","preventionTips":["Use a supported built-in browser provider (playwright, webdriverio) with the matching browser package installed.","Keep browser provider versions compatible with your Vitest version.","Confirm config.browser.enabled is true and the provider name is spelled correctly."],"tags":["browser","internal-bug","provider","assertion"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}