vitest-dev/vitest · error · TypeError
The browser server was not initialized${project.name ? ` for
Error message
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. What it means
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.
Source
Thrown at packages/vitest/src/node/pools/browser.ts:95
testLocations: testLines,
testIds,
testNamePattern,
testTagsFilter,
fileTags: testFileTags.get(spec),
})
groupedFiles.set(project, files)
}
let isCancelled = false
vitest.onCancel(() => {
isCancelled = true
})
const initialisedPools = await Promise.all(Array.from(groupedFiles.entries(), async ([project, files]) => {
await project._initBrowserProvider()
if (!project.browser) {
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.`)
}
if (isCancelled) {
return
}
debug?.('provider is ready for %s project', project.name)
const pool = ensurePool(project)
vitest.state.clearFiles(project, files.map(f => f.filepath))
providers.add(project.browser!.provider)
return {
pool,
provider: project.browser!.provider,
runTests: () => pool.runTests(method, files),
}
}))View on GitHub (pinned to d568f8ce37)
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.
Defensive patterns
Strategy: try-catch
Validate before calling
// Confirm browser provider loads before delegating to the pool
const project = vitest.projects.find(p => p.config.browser.enabled)
await project._initBrowserProvider()
if (!project.browser) {
throw new Error('Browser provider failed to initialize; check provider config/install')
} Try / catch
try {
await vitest.start()
} catch (e) {
if (e.message.startsWith('The browser server was not initialized')) {
console.error('Browser provider init failed. Verify config.browser.provider is installed.')
}
throw e
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Orchestrator not found for session ${sessionId}. This is a b
- Unexpected empty queue
- The ${provider.name} provider does not support tracing.
- The ${context.provider.name} provider does not support traci
- provider ${context.provider.name} is not supported
AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03).
Data as JSON: /data/errors/f23d1b0662f3a124.json.
Report an issue: GitHub.