vercel/turborepo · error · ConvertError
bun-workspace_glob_error
bun-workspace_glob_error
Error message
Unable to convert project to bun - workspace globs unsupported
What it means
The bun manager's create() validates the project's workspace globs with isCompatibleWithBunWorkspaces(), which mirrors bun's own lockfile glob rules: no '**' recursive segments, '*' only in the final path segment, and none of the characters '!', '[', ']', '{', '}'. If any glob violates a rule, conversion aborts with ConvertError type bun-workspace_glob_error before files are written. Turborepo deliberately will not rewrite globs to make a project fit.
Source
Thrown at packages/turbo-workspaces/src/managers/bun.ts:101
};
}
/**
* Create bun workspaces from generic format
*
* Creating bun workspaces involves:
* 1. Validating that the project can be converted to bun workspace
* 2. Adding the workspaces field in package.json
* 3. Setting the devEngines.packageManager field in package.json
* 4. Updating all workspace package.json dependencies to ensure correct format
*/
// eslint-disable-next-line @typescript-eslint/require-await -- must match the create type signature
async function create(args: CreateArgs): Promise<void> {
const { project, to, logger, options } = args;
const hasWorkspaces = project.workspaceData.globs.length > 0;
if (!isCompatibleWithBunWorkspaces({ project })) {
throw new ConvertError(
"Unable to convert project to bun - workspace globs unsupported",
{
type: "bun-workspace_glob_error"
}
);
}
logger.mainStep(
getMainStep({
packageManager: PACKAGE_MANAGER_DETAILS.name,
action: "create",
project
})
);
const packageJson = getPackageJson({ workspaceRoot: project.paths.root });
logger.rootHeader();
// package managerView on GitHub (pinned to 9f94a7d215)
Solutions
- Restructure globs so '*' appears only in the last segment: 'packages/*' instead of 'packages/**'
- Remove brace expansion ('{a,b}') and negation ('!pkg') patterns; enumerate members explicitly or relocate excluded packages
- If restructuring is impossible, convert manually: write a bun-compatible workspaces field and devEngines.packageManager yourself
Example fix
// before (pnpm-workspace.yaml) packages: - 'packages/**' - '!packages/**/dist' // after (bun-compatible) packages: - 'apps/*' - 'packages/*'
Defensive patterns
Strategy: validation
Validate before calling
function isBunCompatibleGlob(glob: string): boolean {
if (glob.includes("*")) {
if (glob.includes("**")) return false;
const beforeLastSegment = glob.split("/").slice(0, -1).join("/");
if (beforeLastSegment.includes("*")) return false;
}
return !["!", "[", "]", "{", "}"].some((c) => glob.includes(c));
}
const incompatible = project.workspaceData.globs.filter((g) => !isBunCompatibleGlob(g));
if (incompatible.length) {
throw new Error(`Fix globs before bun conversion: ${incompatible.join(", ")}`);
} Type guard
function isBunGlobError(e: unknown): boolean {
return e instanceof ConvertError && e.type === "bun-workspace_glob_error";
} Try / catch
try {
await convertProject({ project, convertTo: bunDetails, logger });
} catch (e) {
if (e instanceof ConvertError && e.type === "bun-workspace_glob_error") {
// flatten globs (packages/** -> packages/*) or enumerate workspaces explicitly, then retry
} else throw e;
} Prevention
- Keep workspace globs simple ('apps/*', 'packages/*') so they stay portable across managers
- Avoid '**', brace expansion, and negation in workspace definitions
- Pre-validate globs against bun's rules before offering bun as a conversion target
When it happens
Trigger: Converting to bun a workspace whose globs include 'packages/**', 'apps/*/lib', 'packages/{a,b}', or '!excluded-pkg' — patterns legal in pnpm/yarn workspaces but rejected by bun's implementation.
Common situations: pnpm-workspace.yaml with recursive globs for nested packages; monorepos using brace expansion or negation; yarn workspaces arrays with multiple levels.
Related errors
- package_manager-already_in_use
- package_manager-could_not_be_found
- package_manager-unsupported_version
- package_manager-unexpected
- error_removing_node_modules
AI-assisted analysis of vercel/turborepo@9f94a7d215 (2026-08-16).
Data as JSON: /api/errors/ea87eb3492a92cbc.
Report an issue: GitHub.