vitest-dev/vitest · error · TypeError
vitest.mergeReports() expects all paths in "${blobsDirectory
Error message
vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a valid blob file What it means
Thrown as a `TypeError` by `readBlobs` (blob.ts:135) when a file in the merge-reports directory parses via `flatted.parse` but the resulting tuple has no `version` field. A valid blob file is a flatted-stringified array whose first element is the Vitest version that wrote it (see BlobReporter.onTestRunEnd at blob.ts:72-80); a missing version means the file was not produced by the blob reporter.
Source
Thrown at packages/vitest/src/node/reporters/blob.ts:135
projectsArray: TestProject[],
): Promise<MergedBlobs> {
// using process.cwd() because --merge-reports can only be used in CLI
const resolvedDir = resolve(process.cwd(), blobsDirectory)
const blobsFiles = await readdir(resolvedDir)
const promises = blobsFiles.map(async (filename) => {
const fullPath = resolve(resolvedDir, filename)
const stats = await stat(fullPath)
if (!stats.isFile()) {
throw new TypeError(
`vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a file`,
)
}
const content = await readFile(fullPath, 'utf-8')
const [version, files, errors, coverage, executionTime, environmentModules, transformTime] = parse(
content,
) as MergeReport
if (!version) {
throw new TypeError(
`vitest.mergeReports() expects all paths in "${blobsDirectory}" to be files generated by the blob reporter, but "${filename}" is not a valid blob file`,
)
}
return { version, files, errors, coverage, file: filename, executionTime, environmentModules, transformTime }
})
const blobs = await Promise.all(promises)
if (!blobs.length) {
throw new Error(
`vitest.mergeReports() requires at least one blob file in "${blobsDirectory}" directory, but none were found`,
)
}
const versions = new Set(blobs.map(blob => blob.version))
if (versions.size > 1) {
throw new Error(
`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')}`,
)View on GitHub (pinned to d568f8ce37)
Solutions
- Regenerate the blob files by running the blob reporter fresh and merge only those.
- Delete any non-blob files from the merge-reports directory before merging.
- Ensure the merge-reports directory only contains files written by `BlobReporter` (the default `blob-*.json` outputs).
Example fix
# remove stale/manual files, then regenerate rm -rf ./blob-reports && vitest --reporter=blob vitest --merge-reports ./blob-reports
Defensive patterns
Strategy: validation
Validate before calling
import { readdirSync, readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { parse } from 'flatted'
for (const name of readdirSync(blobsDirectory)) {
const parsed = parse(readFileSync(resolve(blobsDirectory, name), 'utf-8'))
if (!Array.isArray(parsed) || !parsed[0]) throw new Error(`${name} is not a valid blob file`)
} Type guard
import { parse } from 'flatted'
const isBlobFile = (raw: string): boolean => { try { const p = parse(raw); return Array.isArray(p) && !!p[0] } catch { return false } } Prevention
- Only place files written by BlobReporter into the merge directory.
- Never hand-edit or hand-create blob files.
- Regenerate blobs from scratch after format-affecting upgrades.
When it happens
Trigger: Manually placing an arbitrary JSON/text file in the merge-reports directory; copying a partial or truncated blob file; a file written by an older/newer format that lacks the version tuple; a file produced by a different tool that happens to be valid JSON but not a blob report.
Common situations: Mixing manual JSON outputs into the blob directory; a corrupted or half-written blob file from a crashed run; using the wrong directory as the merge-reports source.
Related errors
- vitest.mergeReports() expects all paths in "${blobsDirectory
- vitest.mergeReports() requires at least one blob file in "${
- vitest.mergeReports() requires all blob files to be generate
- the blobs in "${blobsDirectory}" were generated by a differe
- Blob reporter is not supported in watch mode
AI-assisted analysis of vitest-dev/vitest@d568f8ce37 (2026-08-03).
Data as JSON: /data/errors/2919417f59e23d95.json.
Report an issue: GitHub.