vitest-dev/vitest · error · Error

No projects matched the filter "${filter}".

Error message

No projects matched the filter "${filter}".

What it means

When `--project <name>` (or `test.project` in config) filters the workspace, Vitest keeps only projects whose name matches. If none match, core.ts:420-424 throws listing the filter(s) you passed, so you know the filter itself is wrong rather than silently running nothing.

Source

Thrown at packages/vitest/src/node/core.ts:423

          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 d568f8ce37)

Solutions

  1. Check the available project names (e.g. via `vitest --list` or your workspace file) and correct the filter.
  2. Ensure each project sets `test.name` to the value you are filtering on.
  3. Remove the --project flag to run all projects if filtering is not required.

Example fix

# before
vitest --project unttests
# after
vitest --project unit-tests
Defensive patterns

Strategy: validation

Validate before calling

function assertProjectFilterMatches(names: string[], filter: string[]) {
  const matched = filter.some(f => names.includes(f))
  if (filter.length && !matched) throw new Error(`No project matched filter ${filter.join(', ')}. Available: ${names.join(', ')}`)
}

Type guard

function projectFilterMatches(names: string[], filter: string[]): boolean {
  return filter.length === 0 || filter.some(f => names.includes(f))
}

Prevention

When it happens

Trigger: Run `vitest --project nonexistent` or `vitest --project unit --project e2e` when the workspace only has projects named 'app' and 'lib'.

Common situations: Typo in the project name; renaming a project without updating CI scripts; filter referencing an old project name after a refactor.

Related errors


AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03). Data as JSON: /data/errors/7f1532a84dffc39e.json. Report an issue: GitHub.