vitest-dev/vitest · error · Error

vitest.mergeReports() requires at least one blob file in

Error message

vitest.mergeReports() requires at least one blob file in "${blobsDirectory}" directory, but none were found

What it means

The blobs directory exists and is readable but `readdir` returned zero entries, so there is nothing to merge. Vitest throws rather than producing an empty merged report.

Solutions

  1. Generate blobs first: run tests with `reporters: ['blob']` and `--run`.
  2. Confirm the directory path matches where `BlobReporter.onTestRunEnd` actually wrote (it logs `blob report written to <path>`).
  3. Check shard config: each shard must write its own blob into the same directory.

Example fix

# before: merging an empty dir
vitest --merge-reports=./blobs   # error: no blob files

# after: generate first, then merge
vitest --run --reporter=blob
vitest --merge-reports=./blobs
Defensive patterns

Strategy: validation

Validate before calling

import { readdir } from 'node:fs/promises'
async function assertBlobsDirNonEmpty(dir: string) {
  const entries = await readdir(dir)
  if (entries.length === 0) {
    throw new Error(`No blob files in '${dir}'. Run tests with reporters: ['blob'] and --run first.`)
  }
}

Prevention

When it happens

Trigger: Calling `vitest --merge-reports ./empty-dir` (or `vitest.mergeReports(version, './empty-dir', projects)`) before any blob has been written.

Common situations: Forgot to run tests with the blob reporter first; wrong directory path; the output dir was cleaned between the generate and merge steps; glob/outputFile misconfiguration wrote blobs elsewhere.

Related errors


AI-assisted analysis of vitest-dev/vitest@1fa9837ec2 (2026-08-11). Data as JSON: /api/errors/1d882e783df9da10. Report an issue: GitHub.

Appendix: source

Thrown at packages/vitest/src/node/reporters/blob.ts:143

      throw new TypeError(
        `vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a file`,
      )
    }
    const content = await readFile(fullPath, 'utf-8')
    const [version, files, errors, coverage, executionTime, environmentModules] = parse(
      content,
    ) as MergeReport
    if (!version) {
      throw new TypeError(
        `vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a valid blob file`,
      )
    }
    return { version, files, errors, coverage, file: filename, executionTime, environmentModules }
  })
  const blobs = await Promise.all(promises)

  if (!blobs.length) {
    throw new Error(
      `vitest.mergeReports() requires at least one blob file in "${blobsDirectory}" directory, but none were found`,
    )
  }

  const versions = new Set(blobs.map(blob => blob.version))
  if (versions.size > 1) {
    throw new Error(
      `vitest.mergeReports() requires all blob files to be generated by the same Vitest version, received\n\n${blobs.map(b => `- "${b.file}" uses v${b.version}`).join('\n')}`,
    )
  }

  if (!versions.has(currentVersion)) {
    throw new Error(
      `the blobs in "${blobsDirectory}" were generated by a different version of Vitest. Expected v${currentVersion}, but received v${blobs[0].version}`,
    )
  }

  // Restore module graph

View on GitHub (pinned to 1fa9837ec2)