{"record":{"id":"d251e48057b20693","repo":"oven-sh/bun","slug":"invalid-data-object-json-stringify-data","errorCode":null,"errorMessage":"Invalid data object: ${JSON.stringify(data)}","messagePattern":"Invalid data object: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/postMessage/postMessage-object.mjs","lineNumber":60,"sourceCode":"        case ${objects.small.property.length}:\n        case ${objects.medium.property.length}:\n        case ${objects.large.property.length}: {\n          if (\n            data.a === \"a!\" && \n            data.b === \"b!\" && \n            data.second === \"c!\" && \n            data.bool === true && \n            data.nully === null && \n            data.undef === undefined && \n            data.int === 0 && \n            data.double === 1.234 && \n            data.falsy === false) {\n            Atomics.add(int, 0, 1);\n            break;    \n          }\n        }\n        default: {\n          throw new Error(\"Invalid data object: \" + JSON.stringify(data));\n        }\n      }\n      \n    });\n  `;\n\n  worker = new Worker(workerCode, { eval: true, workerData: receivedCount });\n\n  worker.on(\"message\", confirmationId => {});\n\n  worker.on(\"error\", error => {\n    console.error(\"Worker error:\", error);\n  });\n}\n\n// Initialize worker before running benchmarks\ncreateWorker();\n","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/postMessage/postMessage-object.mjs#L42-L78","documentation":"The lockfile's format/version is newer than this Bun understands. For binary bun.lockb: format > FormatVersion::current() (src/install/lockfile/bun.lockb.rs:411-412). During migration it fires for unsupported npm package-lock.json lockfileVersions (src/install/migration.rs:269-278, which suggests regenerating with `npm install --package-lock-only --lockfile-version=3`) and for too-new pnpm lockfile versions (migration.rs:106-115).","triggerScenarios":"A teammate or CI running a newer Bun committed bun.lockb/bun.lock; migrating a package-lock.json at v1/v2; a pnpm-lock.yaml written by a newer pnpm than Bun's migrator supports.","commonSituations":"Mixed Bun versions across a team or between local machine and CI; picking up a repo after the lockfile was upgraded elsewhere.","solutions":["Upgrade Bun to at least the version that wrote the lockfile (`bun upgrade` or reinstall)","For package-lock.json migration, regenerate at v3: `npm install --package-lock-only --lockfile-version=3`","Or delete the lockfile and let your current Bun re-resolve","Pin a team-wide Bun version via package.json `packageManager` / engines and CI images"],"exampleFix":"# before: older Bun + newer lockfile\n$ bun install\nerror: Unexpected lockfile version\n\n# after\n$ bun upgrade && bun install","handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nfunction lockfileVersionSupported() {\n  if (existsSync(\"package-lock.json\")) {\n    const v = require(\"./package-lock.json\").lockfileVersion;\n    return v === 3; // Bun migrates lockfileVersion 3 only\n  }\n  return true; // bun.lock/bun.lockb: upgrade Bun instead\n}","typeGuard":"const isSupportedPackageLock = (lock) => typeof lock?.lockfileVersion === \"number\" && lock.lockfileVersion === 3;","tryCatchPattern":null,"preventionTips":["Pin one Bun version across the team via package.json `packageManager` and CI images","When importing npm projects, regenerate package-lock.json at lockfileVersion 3 before `bun install`","Watch release notes for lockfile format bumps before upgrading lockfiles in monorepos"],"tags":["lockfile","version","migration","install"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}