can1357/oh-my-pi · error · Error

no .tgz produced by bun pm pack

Error message

no .tgz produced by bun pm pack

What it means

After `bun pm pack` reports success, the runner scans benchDir for the newest *.tgz it should have produced. If none is found, it throws — meaning pack exited 0 but wrote the tarball somewhere else (or none at all), so the runner cannot proceed to install it.

Source

Thrown at packages/metaharness/src/runner.ts:1003

}

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;
	} catch {
		return null;
	}
}

// ─────────────────────────────────────────────────────── source mount (--install source)

View on GitHub (pinned to 9690622007)

Solutions

  1. Check where the tgz landed: `find . -name '*.tgz' -newer /tmp -mmin -5` and confirm pack's destination matches benchDir.
  2. Run `bun pm pack` manually in packages/coding-agent to see the printed output path.
  3. Remove publishConfig.packDestination or similar redirects from package.json so output lands in benchDir.
  4. Align bun version with the one the harness expects (`bun --version` vs repo's packageManager/bun requirement).
  5. Avoid concurrent runs sharing one benchDir; use a separate jobs dir per run.

Example fix

// before
"publishConfig": { "packDestination": "../dist" }   // pack output escapes benchDir
// after
// remove packDestination so the runner finds the .tgz in benchDir
Defensive patterns

Strategy: try-catch

Validate before calling

import * as fs from "node:fs";
const before = fs.readdirSync(benchDir).filter(f => f.endsWith(".tgz"));
// after invoking pack, verify exactly:
const after = fs.readdirSync(benchDir).filter(f => f.endsWith(".tgz"));
if (after.length <= before.length) throw new Error("pack produced no new .tgz in benchDir");

Try / catch

try {
  const tgz = packCodingAgent(benchDir);
} catch (e) {
  if (e instanceof Error && e.message === "no .tgz produced by bun pm pack") {
    console.error("bun pm pack exited 0 but no .tgz landed in the bench dir — check pack destination config and bun version.");
  } else throw e;
}

Prevention

When it happens

Trigger: bun pm pack wrote the .tgz to the package directory rather than benchDir (bun versions/config differences); a leftover `.tgz` filtering mismatch (e.g. output named .tar.gz); bun's exit code 0 despite a no-op due to pack config (packageManager/publishConfig.packDestination) pointing elsewhere.

Common situations: Mixed bun versions between machines/CI where `bun pm pack` destination behavior differs; a publishConfig in package.json redirecting pack output; the tgz got created and immediately consumed/moved by a concurrent run sharing the same benchDir.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/b47c98bb025b5cda. Report an issue: GitHub.