{"id":"1d882e783df9da10","repo":"vitest-dev/vitest","slug":"vitest-mergereports-requires-at-least-one-blob-f","errorCode":null,"errorMessage":"vitest.mergeReports() requires at least one blob file in \"${blobsDirectory}\" directory, but none were found","messagePattern":"vitest\\.mergeReports\\(\\) requires at least one blob file in \"(.+?)\" directory, but none were found","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/reporters/blob.ts","lineNumber":144,"sourceCode":"      throw new TypeError(\n        `vitest.mergeReports() expects all paths in \"${blobsDirectory}\" to be files generated by the blob reporter, but \"${filename}\" is not a file`,\n      )\n    }\n    const content = await readFile(fullPath, 'utf-8')\n    const [version, files, errors, coverage, executionTime, environmentModules, transformTime] = parse(\n      content,\n    ) as MergeReport\n    if (!version) {\n      throw new TypeError(\n        `vitest.mergeReports() expects all paths in \"${blobsDirectory}\" to be files generated by the blob reporter, but \"${filename}\" is not a valid blob file`,\n      )\n    }\n    return { version, files, errors, coverage, file: filename, executionTime, environmentModules, transformTime }\n  })\n  const blobs = await Promise.all(promises)\n\n  if (!blobs.length) {\n    throw new Error(\n      `vitest.mergeReports() requires at least one blob file in \"${blobsDirectory}\" directory, but none were found`,\n    )\n  }\n\n  const versions = new Set(blobs.map(blob => blob.version))\n  if (versions.size > 1) {\n    throw new Error(\n      `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')}`,\n    )\n  }\n\n  if (!versions.has(currentVersion)) {\n    throw new Error(\n      `the blobs in \"${blobsDirectory}\" were generated by a different version of Vitest. Expected v${currentVersion}, but received v${blobs[0].version}`,\n    )\n  }\n\n  // Restore module graph","sourceCodeStart":126,"sourceCodeEnd":162,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/reporters/blob.ts#L126-L162","documentation":"Thrown by `readBlobs` (blob.ts:144) when the `--merge-reports` directory exists and `readdir` succeeds but returns zero entries (`blobs.length === 0`). Merging requires at least one blob file to have anything to report, so an empty directory is treated as a user error rather than silently producing an empty result.","triggerScenarios":"Running `vitest --merge-reports <dir>` against an empty directory; pointing at a directory where blob files were already cleaned up; mistyping the path so it resolves to an unrelated empty folder.","commonSituations":"Forgetting to run the blob-reporter pass before the merge pass; CI pipeline ordering bug that merges before any shard has written its blob; path typos.","solutions":["Run the test suite(s) with `--reporter=blob` first so blob files are actually written into the directory.","Verify the directory path passed to `--merge-reports` is the one the blob reporter wrote to.","Check that no cleanup step removed the blob files between the write and merge steps."],"exampleFix":"# before\nvitest --merge-reports ./empty-dir\n# after\nvitest --reporter=blob   # writes blob files first\nvitest --merge-reports ./blob-reports","handlingStrategy":"validation","validationCode":"import { readdirSync } from 'node:fs'\nif (readdirSync(blobsDirectory).length === 0) {\n  throw new Error('No blob files to merge; run with --reporter=blob first')\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always run the blob-reporter pass before the merge pass in CI.","Verify blob files exist before invoking merge.","Guard the merge step behind a check that the dir is non-empty."],"tags":["reporter","blob","merge-reports","empty-state"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}