vitest-dev/vitest · error · Error

No projects were found in "${relativeFile}". Make sure your

Error message

No projects were found in "${relativeFile}". Make sure your configuration is correct.

What it means

Inside flattenContainerEntries (resolveProjects.ts:449-453), after recursively resolving a container config's projects, if the result is empty Vitest throws naming the container file. Unlike the top-level 286 error, this fires per-container: the container declared projects but none of its children resolved into actual entries.

Source

Thrown at packages/vitest/src/node/projects/resolveProjects.ts:450

            [...chain, realConfigFile].map(file => `"${relative(context.rootConfig.root, file)}"`).join(' -> '),
            '. Make sure your configuration is correct.',
          ].join(''),
        )
      }
      chain = [...chain, realConfigFile]
      context.containerConfigFiles.push(configFile)
    }

    const childContext: ProjectsResolutionContext = {
      ...context,
      parentViteConfig: entry.viteConfig,
      parentConfig: entry.projectConfig,
      ancestors: [...context.ancestors, entry.projectConfig.name],
      chain,
    }
    const children = await resolveDeclaredProjectEntries(childContext, definitions)
    if (!children.length) {
      throw new Error(
        `No projects were found in "${relativeFile}". Make sure your configuration is correct.`,
      )
    }
    result.push(...children)
  }
  return result
}

function safeRealpath(path: string): string {
  try {
    return realpathSync(path)
  }
  catch {
    return path
  }
}

// `name` must stay unique per project, `projects` would redefine the whole workspace

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Check that the container's projects array references real, resolvable project files/directories.
  2. Remove the container if it has no real children, or fix the glob to match existing projects.
  3. Ensure the --project filter doesn't exclude every child of this container.
  4. Inspect the container file named in the error to see its projects declaration.

Example fix

// before: container.config.ts
class Container { projects = ['packages/*/vitest.config.ts'] } // matches nothing

// after
class Container { projects = ['packages/*/vite.config.ts'] } // correct filename pattern
Defensive patterns

Strategy: validation

Validate before calling

const childCount = await countResolvedProjects(containerProjects)
if (childCount === 0) throw new Error(`Container '${containerFile}' resolves to zero projects; check its projects array`)

Type guard

function nonEmpty<T>(arr: T[]): boolean { return arr.length > 0 }

Prevention

When it happens

Trigger: A container config declares projects: [...] but every child is filtered out, references non-existent files, or itself resolves to nothing; a container's projects array is effectively empty after glob expansion.

Common situations: A container wraps a glob like 'packages/*/vitest.config.ts' but no sub-package has that file; all child projects were excluded by a misapplied --project filter scoped to the container; nested container whose children all fail (those would surface as 287).

Related errors


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