vitest-dev/vitest · error · Error
Vitest wasn't able to resolve any project.${resolved.browser
Error message
Vitest wasn't able to resolve any project.${resolved.browser.enabled && !resolved.browser.instances?.length ? ` Please, check that you specified the "browser.instances" option.` : ``} What it means
Vitest could not resolve any project at all — the workspace yielded zero projects and no --project filter was set. When browser mode is on but no instances are configured, the message appends a hint about `browser.instances`. core.ts:426-430 throws this generic resolution failure.
Source
Thrown at packages/vitest/src/node/core.ts:430
}))
if (resolved.cliOptions.browser?.enabled) {
const browserProjects = this.projects.filter(p => p.config.browser.enabled)
if (!browserProjects.length) {
throw new Error(`Vitest received --browser flag, but no project had a browser configuration.`)
}
}
if (!this.projects.length) {
const filter = toArray(resolved.project).join('", "')
if (filter) {
throw new Error(`No projects matched the filter "${filter}".`)
}
else {
let error = `Vitest wasn't able to resolve any project.`
if (resolved.browser.enabled && !resolved.browser.instances?.length) {
error += ` Please, check that you specified the "browser.instances" option.`
}
throw new Error(error)
}
}
if (!this.coreWorkspaceProject) {
this.coreWorkspaceProject = TestProject._createBasicProject(this)
}
if (resolved.testNamePattern) {
this.configOverride.testNamePattern = resolved.testNamePattern
}
// populate will merge all configs into every project,
// we don't want that when just listing tags
if (!resolved.listTags) {
populateProjectsTags(this.coreWorkspaceProject, this.projects)
}
this.reporters = await createReporters(resolved.reporters, this)View on GitHub (pinned to d568f8ce37)
Solutions
- Ensure a valid vitest.config.ts or vitest.workspace.ts exists at the project root and exports a config.
- If browser mode is on, define at least one instance: `browser: { enabled: true, instances: [{ browser: 'chromium' }] }`.
- Run `vitest --config <path>` to point Vitest at the config explicitly if it is not at the default location.
- Verify your workspace file's glob patterns actually match test directories.
Example fix
// before — browser enabled, no instances
export default defineConfig({ test: { browser: { enabled: true } } })
// after
export default defineConfig({ test: { browser: { enabled: true, instances: [{ browser: 'chromium' }] } } }) Defensive patterns
Strategy: validation
Validate before calling
function assertResolvableConfig(config: any) {
if (!config) throw new Error('No vitest config resolved; ensure vitest.config.ts exists.')
if (config.browser?.enabled && !(config.browser.instances?.length)) {
throw new Error('Browser enabled but no browser.instances defined.')
}
} Type guard
function isConfigResolvable(config: any): boolean {
return !!config && (!config.browser?.enabled || (config.browser.instances?.length ?? 0) > 0)
} Prevention
- Keep a valid vitest.config.ts or vitest.workspace.ts at the root.
- When enabling browser mode, always define at least one instance.
- Use --config explicitly when the config lives elsewhere.
When it happens
Trigger: Run vitest with no config, a broken workspace file, or `test.browser.enabled: true` without any `browser.instances` (and no default applies).
Common situations: Empty or mis-located vitest.workspace.ts; config file not picked up due to wrong path; browser enabled without instances; broken project glob.
Related errors
- All browser instances within a project must use the same pro
- Vitest received --browser flag, but no project had a browser
- You've enabled headless mode for "preview" provider but it d
- vitest/browser can be imported only inside the Browser Mode.
- Looks like you set "test.environment" to "browser". To enabl
AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03).
Data as JSON: /data/errors/05d42302c542b45d.json.
Report an issue: GitHub.