vitest-dev/vitest · error · Error

Cannot merge reports when `--reporter=blob` is used. Remove

Error message

Cannot merge reports when `--reporter=blob` is used. Remove blob reporter from the config first.

What it means

Vitest.mergeReports() (core.ts:677) refuses to run while a BlobReporter is in the active reporters list. The blob reporter's job is to write blob files; mergeReports' job is to read them back — doing both in one process is contradictory, so vitest prevents it.

Source

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

    return this._coverageProvider
  }

  /**
   * Deletes all Vitest caches, including the `fsModuleCache`.
   * @experimental
   */
  public async experimental_clearCache(): Promise<void> {
    await this.cache.results.clearCache()
    await this._fsCache.clearCache()
  }

  /**
   * Merge reports from multiple runs located in the specified directory (value from `--merge-reports` if not specified).
   */
  public async mergeReports(directory?: string): Promise<TestRunResult> {
    return this._traces.$('vitest.merge_reports', async () => {
      if (this.reporters.some(r => r instanceof BlobReporter)) {
        throw new Error('Cannot merge reports when `--reporter=blob` is used. Remove blob reporter from the config first.')
      }

      const { files, errors, coverages, executionTimes, transformTimes } = await readBlobs(this.version, directory || this.config.mergeReports, this.projects)
      this.state.blobs = { files, errors, coverages, executionTimes, transformTimes }
      this.state.transformTime = transformTimes.reduce((a, b) => a + b, 0)

      await this.report('onInit', this)

      const specifications: TestSpecification[] = []
      for (const file of files) {
        const project = this.getProjectByName(file.projectName || '')
        const specification = project.createSpecification(file.filepath, undefined, file.pool, file.id)
        specifications.push(specification)
      }

      await this._testRun.start(specifications)
      await this.coverageProvider?.onTestRunStart?.()

View on GitHub (pinned to d568f8ce37)

Solutions

  1. Remove the blob reporter from config/CLI for the merge run (use only the merge-report consumer).
  2. Split into two invocations: one with --reporter=blob to produce blobs, a separate one with --merge-reports to consume them.
  3. Use distinct config files or CLI overrides for the produce vs. merge phases.

Example fix

// vitest.config.ts (merge step)
// before
test: { reporters: ['blob', 'default'] }

// after (merge-only run)
test: { reporters: ['default'] }
// invoke: vitest --merge-reports
Defensive patterns

Strategy: validation

Validate before calling

const hasBlob = vitest.reporters.some(r => r instanceof BlobReporter)
if (hasBlob) {
  throw new Error('Remove blob reporter before merging reports')
}
await vitest.mergeReports(dir)

Type guard

function isBlobReporter(r: any): boolean {
  return r?.constructor?.name === 'BlobReporter'
}

Prevention

When it happens

Trigger: Invoking vitest.mergeReports() (or the CLI --merge-reports flow) while the config or CLI still enables reporter: 'blob' / reporter: [['blob', options]].

Common situations: CI pipelines that reuse the same vitest config for both producing and merging blobs; forgetting to remove 'blob' from the reporters array before the merge step.

Related errors


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