oven-sh/bun · error · Error

Expected ${receivedCount[0]} to equal ${sentCount}

Error message

Expected ${receivedCount[0]} to equal ${sentCount}

What it means

The bun.lockb header declares a total buffer size larger than the bytes actually present in the file - i.e. the lockfile is truncated (src/install/lockfile/bun.lockb.rs:429-431).

Source

Thrown at bench/postMessage/postMessage-string.mjs:73

  worker.postMessage(strings.small);
});

bench("postMessage(" + fmt(strings.medium.length) + " string)", async () => {
  sentCount++;
  worker.postMessage(strings.medium);
});

bench("postMessage(" + fmt(strings.large.length) + " string)", async () => {
  sentCount++;
  worker.postMessage(strings.large);
});

await run();

await new Promise(resolve => setTimeout(resolve, 5000));

if (receivedCount[0] !== sentCount) {
  throw new Error("Expected " + receivedCount[0] + " to equal " + sentCount);
}

// Cleanup worker
worker?.terminate();

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Restore from version control: `git checkout -- bun.lockb`
  2. Otherwise delete bun.lockb and `bun install` to rebuild it
  3. Make sure installs complete and the disk has space before saving
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: An install was killed or crashed while rewriting bun.lockb; disk filled mid-save; a partial checkout/clone; git LFS or transfer mangling shortening the file.

Common situations: CI cancelled mid-install; laptops sleeping/crashing during install; incomplete git operations on the binary lockfile.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/b3220984903ecc7e. Report an issue: GitHub.