oven-sh/bun · error · Error

could not pack the install fixture ${pack.stderr}

Error message

could not pack the install fixture
${pack.stderr}

What it means

While constructing the `bun pm install` workload fixture, the generator runs `<bunProfile> pm pack --filename dep.tgz` inside a scratch dependency directory and that invocation exited non-zero; its stderr is appended. This exercises the traced binary itself, so failures usually indicate the binary — not the script — is broken.

Source

Thrown at scripts/orderfile/generate.ts:260

    copyFileSync(join(here, "cli-fixture.js"), join(fixtures, "cli.js"));

    // `bun install`, offline: the one dependency is a tarball packed by the binary
    // we are about to trace, so a slow registry cannot cost a release its order
    // file. The rest is the real path — lockfile, extraction, node_modules.
    const dependency = join(fixtures, "dep");
    const app = join(fixtures, "app");
    mkdirSync(dependency);
    mkdirSync(app);
    writeFileSync(
      join(dependency, "package.json"),
      `{ "name": "orderfile-dep", "version": "1.0.0", "main": "index.js" }\n`,
    );
    writeFileSync(join(dependency, "index.js"), `module.exports = 1;\n`);
    const pack = runCommand([bunProfile, "pm", "pack", "--filename", "dep.tgz"], {
      cwd: dependency,
      label: "bun pm pack",
    });
    if (pack.status !== 0) throw new Error(`could not pack the install fixture\n${pack.stderr}`);
    writeFileSync(
      join(app, "package.json"),
      `{ "name": "orderfile-app", "version": "0.0.0", ` +
        `"dependencies": { "orderfile-dep": "file:../dep/dep.tgz" } }\n`,
    );
    const installEnv = { BUN_INSTALL_CACHE_DIR: join(scratch, "install-cache") };

    const workloads: Workload[] = [
      { name: "bun -e", args: ["-e", "console.log(1)"] },
      { name: "bun hello.ts", args: [join(fixtures, "hello.ts")] },
      { name: "bun server.js", args: [join(fixtures, "server.js")] },
      { name: "bun test", args: ["test", join(fixtures, "tests", "example.test.ts")] },
      { name: "bun install", args: ["install"], cwd: app, env: installEnv },
      { name: "bun install (cached)", args: ["install"], cwd: app, env: installEnv },
      { name: "bun cli.js (pipe)", args: [join(fixtures, "cli.js")], input: CLI_INPUT },
      {
        name: "bun cli.js (tty)",
        args: [join(fixtures, "cli.js")],

View on GitHub (pinned to 8c5296ac45)

Solutions

  1. Reproduce manually: run `<buildDir>/bun-profile pm pack --filename dep.tgz` in an empty dir with a minimal package.json
  2. Confirm the binary executes at all: `file bun-profile` and `bun-profile --version`
  3. Rebuild with `bun run build:release` if the binary is bad
  4. Check scratch disk space/permissions if stderr suggests write failures
Defensive patterns

Strategy: try-catch

Validate before calling

import { spawnSync } from "node:child_process";

// The traced binary must be able to run `pm pack` before we rely on it as a workload engine.
const smoke = spawnSync(bunProfile, ["--version"]);
if (smoke.status !== 0) throw new Error(`${bunProfile} does not execute on this host — fix arch/perm before generating`);

Try / catch

try {
  createInstallFixture();
} catch (err) {
  if (/could not pack the install fixture/.test(String(err))) {
    console.error(`Run \`${bunProfile} pm pack\` manually in a temp dir to see the underlying failure`);
  }
  throw err;
}

Prevention

When it happens

Trigger: The bun-profile binary cannot execute in this environment (wrong arch, missing perm, dynamic loader issue); its `pm pack` implementation crashing; the scratch dir being unwritable or full.

Common situations: Tracing a binary built for another arch (e.g. x64 binary on arm64 without Rosetta); partially linked builds; sandboxed CI blocking tarball writes.

Related errors


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