oven-sh/bun · error · Error

Wrong second byte

Error message

Wrong second byte

What it means

The alignment recorded for the package MultiArrayList does not match the pointer alignment the running build expects (src/install/lockfile/Package.rs:3196-3205). The file was either written by an incompatible serializer or is corrupt.

Source

Thrown at bench/snippets/buffer-concat.mjs:31

  const buffers = [first, second, third];

  const fmt =
    size > 1024 * 1024
      ? new Intl.NumberFormat(undefined, { unit: "megabyte", style: "unit" })
      : size > 1024
        ? new Intl.NumberFormat(undefined, { unit: "kilobyte", style: "unit" })
        : new Intl.NumberFormat(undefined, { unit: "byte", style: "unit" });

  bench(
    `Buffer.concat(${fmt.format(
      Number((size > 1024 * 1024 ? size / 1024 / 1024 : size > 1024 ? size / 1024 : size).toFixed(2)),
    )} x 3)`,
    () => {
      const result = Buffer.concat(buffers);
      if (check) {
        if (result.byteLength != size * 3) throw new Error("Wrong length");
        if (result[0] != 1) throw new Error("Wrong first byte");
        if (result[size] != 2) throw new Error("Wrong second byte");
        if (result[size * 2] != 3) throw new Error("Wrong third byte");

        result[0] = 10;
        if (first[0] != 1) throw new Error("First buffer was modified");

        result[size] = 20;
        if (second[0] != 2) throw new Error("Second buffer was modified");

        result[size * 2] = 30;
        if (third[0] != 3) throw new Error("Third buffer was modified");
      }
    },
  );
}

const chunk = Buffer.alloc(16);
chunk.fill("3");
const array = Array.from({ length: 100 }, () => chunk);

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Delete bun.lockb and regenerate with your current Bun (`bun install`)
  2. If it came from another machine/toolchain, stop sharing that file and regenerate locally
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: A bun.lockb produced by a foreign/incompatible Bun build or mutated after write; reading a lockfile not actually generated by Bun's serializer.

Common situations: Rare - typically only after corruption or hand-crafted lockfiles, since Bun's own writers always record pointer alignment.

Related errors


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