vitest-dev/vitest · error
No projects matched the filter
Error message
No projects matched the filter "${filter}". What it means
Vitest resolves the workspace into a list of `TestProject`s. If the user supplied a project filter (CLI `--project <name>` or config `project`) and that filter matched zero projects, the filter is almost certainly a typo. Vitest names the offending filter so it can be corrected.
Solutions
- List the available project names (`vitest list` or inspect the workspace config) and correct the filter.
- Drop the `--project` flag to run all projects.
- Update CI scripts whenever a project is renamed.
Example fix
# before vitest --project app-server # after (match the real name) vitest --project app
Defensive patterns
Strategy: validation
Validate before calling
const requested = (process.argv.filter((_, i, a) => a[i - 1] === '--project'))
const known = (await vitest.collect()).map(p => p.name)
const missing = requested.filter(r => !known.includes(r))
if (missing.length) {
throw new Error(`Unknown --project values: ${missing.join(', ')}. Known: ${known.join(', ')}`)
} Type guard
function isKnownProject(name: string, known: string[]): boolean {
return known.includes(name)
} Prevention
- Keep a single source of truth for project names and reference it from CI scripts.
- Add a CI lint step that validates `--project` flags against the workspace definition.
When it happens
Trigger: Running `vitest --project app-server` when the workspace only defines projects named `app` and `server`; quoting/glob mismatches in the filter.
Common situations: Rename of a project that wasn't reflected in a CI script; a monorepo filter using a display name instead of the configured project name.
Related errors
- Vitest received --browser flag, but no project had a…
- "browser.instances" was set in the config, but the array is…
- --cache.dir is deprecated
- Found a circular "projects" definition
- Inspector host cannot be a URL. Use "host:port" instead of
AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11).
Data as JSON: /api/errors/7f1532a84dffc39e.
Report an issue: GitHub.
Appendix: source
Thrown at packages/vitest/src/node/core.ts:422
if (!this._warnedExperimentalCacheKeyGenerator) {
this._warnedExperimentalCacheKeyGenerator = true
this.logger.deprecate('`experimental_defineCacheKeyGenerator` is deprecated. Use `defineCacheKeyGenerator` instead.')
}
this._fsCache.defineCacheKeyGenerator(callback)
},
}))
}))
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
}
View on GitHub (pinned to 1fa9837ec2)