oven-sh/bun · error · Error
Mismatch
Error message
Mismatch
What it means
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.
Source
Thrown at bench/scanner/scan.node-esbuild.mjs:22
const ITERATIONS = parseInt(process.env.ITERATIONS || "1") || 1;
const opts = {
metafile: true,
format: "esm",
platform: "neutral",
write: false,
logLevel: "silent",
stdin: {
contents: readFileSync("remix-route.ts", "utf8"),
loader: "ts",
sourcefile: "remix-route.js",
},
};
const getExports = ({ metafile }) => {
for (let i = 0; i < fixture.length; i++) {
if (fixture[i] !== metafile.outputs["stdin.js"].exports[i]) {
throw new Error("Mismatch");
}
}
};
console.time("Get exports");
if (!process.env.SYNC) {
var promises = new Array(ITERATIONS);
for (let i = 0; i < ITERATIONS; i++) {
promises[i] = build(opts).then(getExports);
}
await Promise.all(promises);
} else {
for (let i = 0; i < ITERATIONS; i++) {
getExports(buildSync(opts));
}
}View on GitHub (pinned to 8c5296ac45)
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
Example fix
// before (apps/docs/package.json)
{ "private": true }
// after
{ "name": "@acme/docs", "private": true } Defensive patterns
Strategy: validation
Validate before calling
import { readFileSync } from "node:fs";
function workspacesAreNamed(globs) {
for (const g of globs) {
for (const dir of new Bun.Glob(g.replace(/\/package\.json$/, "")).scanSync(".")) {
const pkg = JSON.parse(readFileSync(`${dir}/package.json`, "utf8"));
if (typeof pkg.name !== "string" || pkg.name === "") return false;
}
}
return true;
} Type guard
const isNamedWorkspace = (pkg) => typeof pkg?.name === "string" && pkg.name.length > 0;
Prevention
- 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
When it happens
Trigger: `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).
Common situations: Adding broad globs like "apps/*" or "**" that sweep in folders not meant to be workspaces; committing half-created packages; JSON with `"name": 123`.
Related errors
- blob.text() failed
- page-cache eviction failed for ${path}; results would be war
- size mismatch
- not called
- not 200
AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16).
Data as JSON: /api/errors/72d6d42a49fdd44d.
Report an issue: GitHub.