{"record":{"id":"2919417f59e23d95","repo":"vitest-dev/vitest","slug":"vitest-mergereports-expects-all-paths-in-blob-291941","errorCode":null,"errorMessage":"vitest.mergeReports() expects all paths in \"${blobsDirectory}\" to be files generated by the blob reporter, but \"${filename}\" is not a valid blob file","messagePattern":"vitest\\.mergeReports\\(\\) expects all paths in \"(.+?)\" to be files generated by the blob reporter, but \"(.+?)\" is not a valid blob file","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/reporters/blob.ts","lineNumber":134,"sourceCode":"  projectsArray: TestProject[],\n): Promise<MergedBlobs> {\n  // using process.cwd() because --merge-reports can only be used in CLI\n  const resolvedDir = resolve(process.cwd(), blobsDirectory)\n  const blobsFiles = await readdir(resolvedDir)\n  const promises = blobsFiles.map(async (filename) => {\n    const fullPath = resolve(resolvedDir, filename)\n    const stats = await stat(fullPath)\n    if (!stats.isFile()) {\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 file`,\n      )\n    }\n    const content = await readFile(fullPath, 'utf-8')\n    const [version, files, errors, coverage, executionTime, environmentModules] = 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 }\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    )","sourceCodeStart":116,"sourceCodeEnd":152,"githubUrl":"https://github.com/vitest-dev/vitest/blob/1fa9837ec26533512fdcad8baebf249771bd340a/packages/vitest/src/node/reporters/blob.ts#L116-L152","documentation":"A file in the blobs directory was read successfully but parsed blob had no `version` field, meaning it is not a Vitest blob report (or is a corrupt/partial one). The merge rejects it with a `TypeError` to avoid silently producing a broken merged report.","triggerScenarios":"An arbitrary JSON/text file (e.g. `package.json`, a log, a half-written blob from a killed process) lands in the blobs directory and is parsed by `flatted.parse`; the destructured first element (`version`) is falsy.","commonSituations":"Reusing a directory that holds other output; a shard process killed mid-write leaving a truncated file; stale blobs from an older format.","solutions":["Delete the offending non-blob file (named in the error) from the blobs directory.","Regenerate all blobs by re-running the blob reporter (`--run` with `reporters: ['blob']`).","Use a clean, dedicated blobs directory for each merge cycle."],"exampleFix":"# remove the bad file (name shown in the error)\nrm ./blobs/not-a-blob.log\n\n# regenerate clean blobs\nvitest --run --reporters=blob --outputFile.blobs=./blobs/x.json","handlingStrategy":"validation","validationCode":"import { readdir, readFile } from 'node:fs/promises'\nimport { parse } from 'flatted'\n\nasync function assertAllBlobsValid(dir: string) {\n  for (const name of await readdir(dir)) {\n    const [version] = parse(await readFile(resolve(dir, name), 'utf-8')) as unknown[]\n    if (!version) {\n      throw new Error(`'${name}' is not a valid blob file (no version). Remove or regenerate it.`)\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't share the blobs directory with logs or other JSON.","Discard partial blobs from killed runs before merging."],"tags":["reporter","blob","merge"],"backgroundTag":null,"analyzedSha":"1fa9837ec26533512fdcad8baebf249771bd340a","analyzedAt":"2026-08-11T16:11:39.638Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}