{"id":"78ed63671e8c5c01","repo":"vitest-dev/vitest","slug":"the-blobs-in-blobsdirectory-were-generated-by","errorCode":null,"errorMessage":"the blobs in \"${blobsDirectory}\" were generated by a different version of Vitest. Expected v${currentVersion}, but received v${blobs[0].version}","messagePattern":"the blobs in \"(.+?)\" were generated by a different version of Vitest\\. Expected v(.+?), but received v(.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/vitest/src/node/reporters/blob.ts","lineNumber":157,"sourceCode":"    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\n  const projects = Object.fromEntries(\n    projectsArray.map(p => [p.name, p]),\n  )\n\n  blobs.forEach((blob) => {\n    Object.entries(blob.environmentModules).forEach(([projectName, modulesByProject]) => {\n      const project = projects[projectName]\n      if (!project) {\n        return\n      }\n\n      modulesByProject.external.forEach(([id, externalized]) => {\n        project._resolver.externalizeCache.set(id, externalized)","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/vitest-dev/vitest/blob/d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09/packages/vitest/src/node/reporters/blob.ts#L139-L175","documentation":"Thrown by `readBlobs` (blob.ts:157) when all blob files share one version but that version differs from `currentVersion` (the version of the Vitest process performing the merge). Because the merge step must deserialize and rehydrate blob structures into the current process, the formats must match exactly; a mismatch is rejected even though the blobs are internally consistent.","triggerScenarios":"Generating blobs with Vitest 3.0.0 and running `vitest --merge-reports` with Vitest 3.1.0; a local merge run using a globally installed `vitest` whose version differs from the one used in CI to write the blobs.","commonSituations":"Local/global Vitest version drift; CI wrote blobs with one version and the merge step uses another; upgrading Vitest between the blob run and the merge run.","solutions":["Run the merge step with the exact same Vitest version that wrote the blob files.","Upgrade (or downgrade) the Vitest used to write the blobs to match the merging process, then regenerate.","Install Vitest locally in the project so both CI and local use the same binary (`npx vitest --merge-reports`)."],"exampleFix":"# before: versions differ\nvitest --reporter=blob        # v3.0.0 in CI\nvitest --merge-reports dir    # v3.1.0 locally\n# after: match versions\nnpx vitest@3.0.0 --merge-reports dir","handlingStrategy":"validation","validationCode":"import { readdirSync, readFileSync } from 'node:fs'\nimport { resolve } from 'node:path'\nimport { parse } from 'flatted'\nimport { version } from 'vitest/package.json'\nconst blobVersion = (parse(readFileSync(resolve(blobsDirectory, readdirSync(blobsDirectory)[0]), 'utf-8')) as any[])[0]\nif (blobVersion !== version) throw new Error(`Merge Vitest v${version} != blob v${blobVersion}`)","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use the same locally-installed Vitest (`npx vitest`) for both writing and merging blobs.","Pin the Vitest version in CI and locally.","After upgrades, regenerate all blobs before merging."],"tags":["reporter","blob","merge-reports","version-mismatch"],"analyzedSha":"d568f8ce3739b532d5bf2c1ee1e45e8a8a473d09","analyzedAt":"2026-08-03T20:23:56.861Z","schemaVersion":2}