oven-sh/bun · error · Error

workload " " recorded no entries — is the tracer loading?

Error message

workload "${name}" recorded no entries — is the tracer loading?

What it means

The trace header is valid but the recorded entry count is zero — the tracer attached (or at least created the file) yet captured no function entries. The message points at the real suspect: the tracer is not actually loading into the traced process.

Solutions

  1. Verify the preload env vars actually reach the bun process (print env from inside a workload)
  2. Confirm starts.bin was generated from the exact bun-profile being traced (same build, same slide handling)
  3. Re-run with verbose output to see per-workload entry counts and spot where capture dies
  4. On macOS, make sure the binary/setup permits library injection
Defensive patterns

Strategy: try-catch

Validate before calling

import { spawnSync } from "node:child_process";

// Smoke test: the tracer must actually attach and record entries for a trivial run.
const smoke = spawnSync(bunProfile, ["-e", "1"], {
  env: { ...process.env, LD_PRELOAD: tracer, BUN_FUNCTRACE_STARTS: starts, BUN_FUNCTRACE_OUT: smokeOut },
});
if (smoke.status !== 0 || statSync(smokeOut, { throwIfNoEntry: false }) === undefined) {
  throw new Error("Tracer is not loading — fix preload env / hardened runtime before full runs");
}

Try / catch

try {
  runWorkloads();
} catch (err) {
  if (/recorded no entries/.test(String(err))) {
    console.error("Preload did not reach the process — verify DYLD_INSERT_LIBRARIES/LD_PRELOAD and starts.bin provenance");
  }
  throw err;
}

Prevention

When it happens

Trigger: LD_PRELOAD/DYLD_INSERT_LIBRARIES being stripped by macOS SIP or a hardened binary, so functrace never instruments anything; BUN_FUNCTRACE_STARTS pointing at a starts.bin built from a different binary so no address matches; tracer built for the wrong platform.

Common situations: macOS arm64 hardened runtime dropping inserted libraries; running the workload through a wrapper (ptyrun) that scrubs env; mismatch between the traced executable and the symbol table used to build starts.bin.

Related errors


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

Appendix: source

Thrown at scripts/orderfile/generate.ts:174

/** Write function starts for functrace.c: u64 magic, version, count, addresses. */
function writeStarts(path: string, addresses: number[]): void {
  const buffer = new ArrayBuffer((STARTS_HEADER_WORDS + addresses.length) * 8);
  const words = new BigUint64Array(buffer);
  words[0] = STARTS_MAGIC;
  words[1] = 1n;
  words[2] = BigInt(addresses.length);
  for (let i = 0; i < addresses.length; i++) words[STARTS_HEADER_WORDS + i] = BigInt(addresses[i]!);
  writeFileSync(path, new Uint8Array(buffer));
}

/** Read a trace functrace.c wrote: first-entry addresses, slide already removed. */
function readTrace(path: string, name: string): number[] {
  const raw = readFileSync(path);
  if (raw.byteLength < TRACE_HEADER_WORDS * 8) throw new Error(`workload "${name}" wrote a truncated trace`);
  const header = new BigUint64Array(raw.buffer, raw.byteOffset, TRACE_HEADER_WORDS);
  if (header[0] !== TRACE_MAGIC || header[1] !== 1n) throw new Error(`workload "${name}" wrote an invalid trace`);
  const count = Number(header[4]);
  if (count === 0) throw new Error(`workload "${name}" recorded no entries — is the tracer loading?`);
  const body = new BigUint64Array(raw.buffer, raw.byteOffset + TRACE_HEADER_WORDS * 8, count);
  const out: number[] = new Array(count);
  for (let i = 0; i < count; i++) out[i] = Number(body[i]);
  return out;
}

export function generateOrderFile(options: GenerateOptions): { count: number; outPath: string } {
  const buildDir = resolve(options.buildDir);
  const outPath = resolve(options.outPath ?? join(buildDir, "linker.order"));
  const minFunctions = options.minFunctions ?? MIN_FUNCTIONS;
  const log = (message: string) => options.verbose && console.log(message);

  const darwin = process.platform === "darwin";
  if (process.platform !== "linux" && !(darwin && process.arch === "arm64")) {
    throw new Error("the order file tracer builds on linux x86-64/arm64 or macOS arm64");
  }

  // The unstripped binary: its symbol table is what maps addresses back to names.

View on GitHub (pinned to 8c5296ac45)