{"record":{"id":"3cc97efe8d0e6b6b","repo":"oven-sh/bun","slug":"wrong-second-byte","errorCode":null,"errorMessage":"Wrong second byte","messagePattern":"Wrong second byte","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/snippets/buffer-concat.mjs","lineNumber":31,"sourceCode":"  const buffers = [first, second, third];\n\n  const fmt =\n    size > 1024 * 1024\n      ? new Intl.NumberFormat(undefined, { unit: \"megabyte\", style: \"unit\" })\n      : size > 1024\n        ? new Intl.NumberFormat(undefined, { unit: \"kilobyte\", style: \"unit\" })\n        : new Intl.NumberFormat(undefined, { unit: \"byte\", style: \"unit\" });\n\n  bench(\n    `Buffer.concat(${fmt.format(\n      Number((size > 1024 * 1024 ? size / 1024 / 1024 : size > 1024 ? size / 1024 : size).toFixed(2)),\n    )} x 3)`,\n    () => {\n      const result = Buffer.concat(buffers);\n      if (check) {\n        if (result.byteLength != size * 3) throw new Error(\"Wrong length\");\n        if (result[0] != 1) throw new Error(\"Wrong first byte\");\n        if (result[size] != 2) throw new Error(\"Wrong second byte\");\n        if (result[size * 2] != 3) throw new Error(\"Wrong third byte\");\n\n        result[0] = 10;\n        if (first[0] != 1) throw new Error(\"First buffer was modified\");\n\n        result[size] = 20;\n        if (second[0] != 2) throw new Error(\"Second buffer was modified\");\n\n        result[size * 2] = 30;\n        if (third[0] != 3) throw new Error(\"Third buffer was modified\");\n      }\n    },\n  );\n}\n\nconst chunk = Buffer.alloc(16);\nchunk.fill(\"3\");\nconst array = Array.from({ length: 100 }, () => chunk);","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/snippets/buffer-concat.mjs#L13-L49","documentation":"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.","triggerScenarios":"A bun.lockb produced by a foreign/incompatible Bun build or mutated after write; reading a lockfile not actually generated by Bun's serializer.","commonSituations":"Rare - typically only after corruption or hand-crafted lockfiles, since Bun's own writers always record pointer alignment.","solutions":["Delete bun.lockb and regenerate with your current Bun (`bun install`)","If it came from another machine/toolchain, stop sharing that file and regenerate locally"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one Bun version to write and read shared lockfiles","Regenerate lockfiles after Bun upgrades in CI before committing them"],"tags":["lockfile","corruption","validation"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}