oven-sh/bun · error · Error

blob.text() failed

Error message

blob.text() failed

What it means

Running a workspace pattern through the glob walker failed with an OS-level error; the pretty error printed alongside names the offending pattern and its errno (src/install/lockfile/Package/WorkspaceMap.rs:398-440 - walker creation, iterator init, and next-match all map to GlobError).

Source

Thrown at bench/snippets/blob.mjs:27

  return small.text();
});

bench("blob.arrayBuffer(small string)", function () {
  return small.arrayBuffer();
});

// if (Blob.prototype.json) {
//   bench("blob.json(small string)", function () {
//     return small.json();
//   });
// }

bench("blob.slice()", function () {
  return small.slice();
});

if ((await small.text()) !== JSON.stringify("hello world ")) {
  throw new Error("blob.text() failed");
}

await run();

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Read the printed pattern + errno and fix or simplify that glob in package.json
  2. Fix filesystem permissions (or exclude) the directory the walk fails on
  3. Replace deep `**` patterns with explicit directory lists
  4. Test patterns with `new Bun.Glob(pattern).match(...)` before committing

Example fix

// before (package.json)
"workspaces": ["**/*"]

// after
"workspaces": ["apps/*", "packages/*"]
Defensive patterns

Strategy: validation

Validate before calling

function workspacesGlobsResolve(globs) {
  for (const pattern of globs) {
    try {
      const matches = [...new Bun.Glob(pattern).scanSync(".")];
      if (matches.length === 0) console.warn(`pattern matches nothing: ${pattern}`);
    } catch {
      return false;
    }
  }
  return true;
}

Type guard

const isSimpleGlob = (p) => !/(\*\*.*\*\*|\[!|\{.*,.*\})/.test(p);

Prevention

When it happens

Trigger: A workspaces glob (from package.json `workspaces`/`workspaces.*` or bunfig) walking into an unreadable directory (EACCES), a path too long, a broken symlink loop, or a pattern the glob walker cannot process on your platform.

Common situations: Restrictive permissions on subdirectories (root-owned dirs inside the repo), exotic glob syntax copied from another tool, huge/deep `**` trees hitting OS limits.

Related errors


AI-assisted analysis of oven-sh/bun@8c5296ac45 (2026-08-16). Data as JSON: /api/errors/a4132779f89fca98. Report an issue: GitHub.