can1357/oh-my-pi · error · Error
bun pm pack failed
Error message
bun pm pack failed
What it means
When building the coding-agent from source for the 'source' install mode, the runner shells out to `bun pm pack` in the coding-agent directory. If the command exits non-zero, the runner dumps its captured stdout/stderr to stderr and throws this generic wrapper error. The real cause is in the piped output, not the message itself.
Source
Thrown at packages/metaharness/src/runner.ts:996
function readPkgVersion(): string {
const raw = readJson(path.join(CODING_AGENT_DIR, "package.json"));
if (raw && typeof raw === "object") {
const v = (raw as Record<string, unknown>).version;
if (typeof v === "string") return v;
}
return "latest";
}
function buildTarball(benchDir: string): string {
process.stdout.write(dim("packing local omp (bun pm pack)…\n"));
const r = spawnSync("bun", ["pm", "pack", "--destination", benchDir], {
cwd: CODING_AGENT_DIR,
encoding: "utf8",
stdio: ["ignore", "pipe", "pipe"],
});
if (r.status !== 0) {
process.stderr.write((r.stdout ?? "") + (r.stderr ?? ""));
throw new Error("bun pm pack failed");
}
const tgz = fs
.readdirSync(benchDir)
.filter(f => f.endsWith(".tgz"))
.map(f => ({ f, m: fs.statSync(path.join(benchDir, f)).mtimeMs }))
.sort((a, b) => b.m - a.m)[0];
if (!tgz) throw new Error("no .tgz produced by bun pm pack");
return path.join(benchDir, tgz.f);
}
function newestTarball(benchDir: string): string | null {
try {
const tgz = fs
.readdirSync(benchDir)
.filter(f => f.endsWith(".tgz"))
.map(f => ({ f, m: fs.statSync(path.join(benchDir, f)).mtimeMs }))
.sort((a, b) => b.m - a.m)[0];
return tgz ? path.join(benchDir, tgz.f) : null;View on GitHub (pinned to 9690622007)
Solutions
- Re-run with the stderr shown just before the throw — it contains bun's actual error message; fix that root cause.
- Ensure bun is installed and on PATH: `which bun && bun --version`.
- Run `bun install` in packages/coding-agent (and repo root) so pack has a consistent lockfile/workspace.
- Verify packages/coding-agent/package.json is valid and the package name/version fields are sane.
- Check disk space and write permissions on the bench directory.
Example fix
// before (shell, reproducing what the runner runs) cd packages/coding-agent && bun pm pack # fails: no node_modules // after bun install && cd packages/coding-agent && bun pm pack
Defensive patterns
Strategy: try-catch
Validate before calling
import { $ } from "bun";
const bunPath = await $`which bun`.quiet().nothrow();
if (bunPath.exitCode !== 0) throw new Error("bun is required to pack the coding-agent from source"); Try / catch
try {
await buildFromSource();
} catch (e) {
if (e instanceof Error && e.message === "bun pm pack failed") {
// root cause was already written to stderr by the runner
console.error("bun pm pack failed — check the stderr above (bun missing? deps not installed?).");
} else throw e;
} Prevention
- Install/verify bun before running source-mode harness jobs.
- Run bun install at the repo root so workspaces are linked before packing.
- Ensure adequate disk space and write access to the bench dir in CI.
When it happens
Trigger: bun not installed or wrong version; the coding-agent package has a broken package.json; bun pm pack fails due to a registry/network issue resolving pack metadata; filesystem permission problems writing the tarball into benchDir.
Common situations: Fresh machine without bun in PATH for the harness process; dirty worktree with missing workspace deps (needs `bun install` first); disk full; running in CI where the monorepo was partially checked out.
Related errors
- no .tgz produced by bun pm pack
- Failed to build stats client (exit ${buildResult.exitCode})$
- bundled Silver.ttf must parse
- utoken: zstd decode failed
- ${argv[0]} exited with code ${exitCode}: ${stderr.trim().sli
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/55bba88a8b03f2c3.
Report an issue: GitHub.