vitest-dev/vitest · error
Vitest wasn't able to resolve any project.
Error message
Vitest wasn't able to resolve any project.
What it means
If after resolving the workspace Vitest has zero projects AND no project filter was supplied, the workspace resolution itself failed to produce anything runnable. When browser mode is enabled but no `browser.instances` were declared, the message is augmented to point at that specific cause; otherwise it is a generic resolution failure.
Source
Thrown at packages/vitest/src/node/core.ts:429
}))
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 1fa9837ec2)
Solutions
- Verify your `vitest.config.ts` / workspace file is at the project root and is valid.
- Check the `include` globs actually match at least one test file.
- If `browser.enabled: true`, add at least one entry to `browser.instances`.
- Run with `--debug` or `vitest list` to see what Vitest resolved.
Example fix
// before
test: { browser: { enabled: true } } // no instances
// after
test: { browser: { enabled: true, instances: [{ browser: 'chromium' }] } } Defensive patterns
Strategy: validation
Validate before calling
import { globSync } from 'tinyglobby'
const hasTests = globSync(['**/*.test.ts', '**/*.spec.ts'], { ignore: ['node_modules/**'] }).length > 0
if (!hasTests) {
throw new Error('No test files matched the default include globs.')
}
if (config.test?.browser?.enabled && !(config.test.browser.instances?.length)) {
throw new Error('browser.enabled requires at least one browser.instances entry.')
} Type guard
function hasBrowserInstances(cfg: any): boolean {
return Array.isArray(cfg?.test?.browser?.instances) && cfg.test.browser.instances.length > 0
} Prevention
- Smoke-test a fresh checkout with `vitest list` to confirm resolution before CI.
- When enabling browser mode, immediately add at least one instance in the same commit.
When it happens
Trigger: An empty workspace file; a config that excludes everything via `include`/`exclude`; browser mode enabled without `browser.instances`; a misnamed config file that Vitest did not load.
Common situations: Fresh repo with no tests matching the default glob; `include` pattern pointing at a non-existent directory; browser config that sets `enabled: true` but forgets the instances array.
Related errors
- vitest/browser can be imported only inside the Browser Mode.
- Vitest received --browser flag, but no project had a browser
- The ${provider.name} provider does not support tracing.
- You've enabled headless mode for "preview" provider but it d
- vitest/browser can be imported only inside the Browser Mode.
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/479e2eced95cc926.
Report an issue: GitHub.