{"record":{"id":"12c142f28a98c33b","repo":"vitest-dev/vitest","slug":"cannot-merge-reports-when-reporter-blob-is-use","errorCode":null,"errorMessage":"Cannot merge reports when `--reporter=blob` is used. Remove blob reporter from the config first.","messagePattern":"Cannot merge reports when `--reporter=blob` is used\\. Remove blob reporter from the config first\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/core.ts","lineNumber":676,"sourceCode":"    return this._coverageProvider\n  }\n\n  /**\n   * Deletes all Vitest caches, including the `fsModuleCache`.\n   * @experimental\n   */\n  public async experimental_clearCache(): Promise<void> {\n    await this.cache.results.clearCache()\n    await this._fsCache.clearCache()\n  }\n\n  /**\n   * Merge reports from multiple runs located in the specified directory (value from `--merge-reports` if not specified).\n   */\n  public async mergeReports(directory?: string): Promise<TestRunResult> {\n    return this._traces.$('vitest.merge_reports', async () => {\n      if (this.reporters.some(r => r instanceof BlobReporter)) {\n        throw new Error('Cannot merge reports when `--reporter=blob` is used. Remove blob reporter from the config first.')\n      }\n\n      const { files, errors, coverages, executionTimes } = await readBlobs(this.version, directory || this.config.mergeReports, this.projects)\n      this.state.blobs = { files, errors, coverages, executionTimes }\n\n      await this.report('onInit', this)\n\n      const specifications: TestSpecification[] = []\n      for (const file of files) {\n        const project = this.getProjectByName(file.projectName || '')\n        const specification = project.createSpecification(file.filepath, undefined, file.pool, file.id)\n        specifications.push(specification)\n      }\n\n      await this._testRun.start(specifications)\n      await this.coverageProvider?.onTestRunStart?.()\n\n      for (const file of files) {","sourceCodeStart":658,"sourceCodeEnd":694,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/core.ts#L658-L694","documentation":"mergeReports refuses to run while a BlobReporter is active because blob reports are the INPUT to a merge, not its output; writing blobs while reading them would corrupt the merged result. The check scans this.reporters for any BlobReporter instance and aborts. You must remove the blob reporter from the config or CLI before merging.","triggerScenarios":"Calling vitest.mergeReports() (or running with --merge-reports) while --reporter=blob is set in config, CLI args, or programmatic options, so this.reporters contains a BlobReporter.","commonSituations":"CI pipelines that always set reporter: ['blob'] then run a merge step in the same job; copy-pasted config combining blob and merge-reports; programmatic API reuse with shared options.","solutions":["Remove reporter: ['blob'] (and --reporter=blob) from the config/CLI used for the merge run.","Run the merge as a separate command/process without the blob reporter.","Conditionally enable blob reporter only on the sharded test runs, not the merge run."],"exampleFix":"// before\nconst vitest = await createVitest('test', { reporters: ['blob'], mergeReports: './blobs' })\nawait vitest.mergeReports()\n\n// after\nconst vitest = await createVitest('test', { reporters: ['default'], mergeReports: './blobs' })\nawait vitest.mergeReports()","handlingStrategy":"validation","validationCode":"import { BlobReporter } from 'vitest/node'\nfunction hasBlobReporter(reporters) {\n  return reporters.some(r => r instanceof BlobReporter)\n}\n// before merge: if (hasBlobReporter(vitest.reporters)) strip blob reporter from config and recreate","typeGuard":null,"tryCatchPattern":"try {\n  await vitest.mergeReports()\n} catch (e) {\n  if (/blob reporter/i.test(e.message)) {\n    // rebuild vitest without reporter:'blob', then retry merge\n  } else throw e\n}","preventionTips":["Keep the blob-reporter run and the merge run in separate processes/commands.","Build the merge command's config from a different preset than the sharded blob run.","Assert no BlobReporter is present before invoking mergeReports in CI scripts."],"tags":["reporters","blob","merge-reports"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}