{"record":{"id":"72d6d42a49fdd44d","repo":"oven-sh/bun","slug":"mismatch-72d6d4","errorCode":null,"errorMessage":"Mismatch","messagePattern":"Mismatch","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"bench/scanner/scan.node-esbuild.mjs","lineNumber":22,"sourceCode":"const ITERATIONS = parseInt(process.env.ITERATIONS || \"1\") || 1;\n\nconst opts = {\n  metafile: true,\n  format: \"esm\",\n  platform: \"neutral\",\n  write: false,\n  logLevel: \"silent\",\n  stdin: {\n    contents: readFileSync(\"remix-route.ts\", \"utf8\"),\n    loader: \"ts\",\n    sourcefile: \"remix-route.js\",\n  },\n};\n\nconst getExports = ({ metafile }) => {\n  for (let i = 0; i < fixture.length; i++) {\n    if (fixture[i] !== metafile.outputs[\"stdin.js\"].exports[i]) {\n      throw new Error(\"Mismatch\");\n    }\n  }\n};\n\nconsole.time(\"Get exports\");\n\nif (!process.env.SYNC) {\n  var promises = new Array(ITERATIONS);\n  for (let i = 0; i < ITERATIONS; i++) {\n    promises[i] = build(opts).then(getExports);\n  }\n\n  await Promise.all(promises);\n} else {\n  for (let i = 0; i < ITERATIONS; i++) {\n    getExports(buildSync(opts));\n  }\n}","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/bench/scanner/scan.node-esbuild.mjs#L4-L40","documentation":"A discovered workspace member's package.json has no usable \"name\": the `name` key is missing or its value is not a string (src/install/lockfile/Package/WorkspaceMap.rs:147-153). Every directory matched by the workspaces globs must expose a named package.json.","triggerScenarios":"`bun install` scanning workspaces globs that match a folder whose package.json lacks `name` (e.g. a leftover scaffolding dir, an examples/docs folder, or a name set to a non-string).","commonSituations":"Adding broad globs like \"apps/*\" or \"**\" that sweep in folders not meant to be workspaces; committing half-created packages; JSON with `\"name\": 123`.","solutions":["Add a unique string `name` to the offending workspace's package.json (the install log names the file)","Or narrow the workspaces glob so the folder is not matched","Or remove/rename the stray package.json if the folder is not a workspace"],"exampleFix":"// before (apps/docs/package.json)\n{ \"private\": true }\n\n// after\n{ \"name\": \"@acme/docs\", \"private\": true }","handlingStrategy":"validation","validationCode":"import { readFileSync } from \"node:fs\";\nfunction workspacesAreNamed(globs) {\n  for (const g of globs) {\n    for (const dir of new Bun.Glob(g.replace(/\\/package\\.json$/, \"\")).scanSync(\".\")) {\n      const pkg = JSON.parse(readFileSync(`${dir}/package.json`, \"utf8\"));\n      if (typeof pkg.name !== \"string\" || pkg.name === \"\") return false;\n    }\n  }\n  return true;\n}","typeGuard":"const isNamedWorkspace = (pkg) => typeof pkg?.name === \"string\" && pkg.name.length > 0;","tryCatchPattern":null,"preventionTips":["Give every workspace member a unique string name from day one","Keep workspaces globs narrow (apps/*, packages/*) so stray folders are not swept in","Add a CI lint that validates all workspace package.json files have names"],"tags":["workspaces","package-json","install"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}