{"record":{"id":"56da0d7474bb274b","repo":"oven-sh/bun","slug":"workload-name-recorded-no-entries-is-the-tr","errorCode":null,"errorMessage":"workload \"${name}\" recorded no entries — is the tracer loading?","messagePattern":"workload \"(.+?)\" recorded no entries — is the tracer loading\\?","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/orderfile/generate.ts","lineNumber":174,"sourceCode":"/** Write function starts for functrace.c: u64 magic, version, count, addresses. */\nfunction writeStarts(path: string, addresses: number[]): void {\n  const buffer = new ArrayBuffer((STARTS_HEADER_WORDS + addresses.length) * 8);\n  const words = new BigUint64Array(buffer);\n  words[0] = STARTS_MAGIC;\n  words[1] = 1n;\n  words[2] = BigInt(addresses.length);\n  for (let i = 0; i < addresses.length; i++) words[STARTS_HEADER_WORDS + i] = BigInt(addresses[i]!);\n  writeFileSync(path, new Uint8Array(buffer));\n}\n\n/** Read a trace functrace.c wrote: first-entry addresses, slide already removed. */\nfunction readTrace(path: string, name: string): number[] {\n  const raw = readFileSync(path);\n  if (raw.byteLength < TRACE_HEADER_WORDS * 8) throw new Error(`workload \"${name}\" wrote a truncated trace`);\n  const header = new BigUint64Array(raw.buffer, raw.byteOffset, TRACE_HEADER_WORDS);\n  if (header[0] !== TRACE_MAGIC || header[1] !== 1n) throw new Error(`workload \"${name}\" wrote an invalid trace`);\n  const count = Number(header[4]);\n  if (count === 0) throw new Error(`workload \"${name}\" recorded no entries — is the tracer loading?`);\n  const body = new BigUint64Array(raw.buffer, raw.byteOffset + TRACE_HEADER_WORDS * 8, count);\n  const out: number[] = new Array(count);\n  for (let i = 0; i < count; i++) out[i] = Number(body[i]);\n  return out;\n}\n\nexport function generateOrderFile(options: GenerateOptions): { count: number; outPath: string } {\n  const buildDir = resolve(options.buildDir);\n  const outPath = resolve(options.outPath ?? join(buildDir, \"linker.order\"));\n  const minFunctions = options.minFunctions ?? MIN_FUNCTIONS;\n  const log = (message: string) => options.verbose && console.log(message);\n\n  const darwin = process.platform === \"darwin\";\n  if (process.platform !== \"linux\" && !(darwin && process.arch === \"arm64\")) {\n    throw new Error(\"the order file tracer builds on linux x86-64/arm64 or macOS arm64\");\n  }\n\n  // The unstripped binary: its symbol table is what maps addresses back to names.","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/oven-sh/bun/blob/8c5296ac459e8252d3cd702f3fbcbb0c249d95d5/scripts/orderfile/generate.ts#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the preload env vars actually reach the bun process (print env from inside a workload)","Confirm starts.bin was generated from the exact bun-profile being traced (same build, same slide handling)","Re-run with verbose output to see per-workload entry counts and spot where capture dies","On macOS, make sure the binary/setup permits library injection"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"import { spawnSync } from \"node:child_process\";\n\n// Smoke test: the tracer must actually attach and record entries for a trivial run.\nconst smoke = spawnSync(bunProfile, [\"-e\", \"1\"], {\n  env: { ...process.env, LD_PRELOAD: tracer, BUN_FUNCTRACE_STARTS: starts, BUN_FUNCTRACE_OUT: smokeOut },\n});\nif (smoke.status !== 0 || statSync(smokeOut, { throwIfNoEntry: false }) === undefined) {\n  throw new Error(\"Tracer is not loading — fix preload env / hardened runtime before full runs\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  runWorkloads();\n} catch (err) {\n  if (/recorded no entries/.test(String(err))) {\n    console.error(\"Preload did not reach the process — verify DYLD_INSERT_LIBRARIES/LD_PRELOAD and starts.bin provenance\");\n  }\n  throw err;\n}","preventionTips":["Run one fast smoke workload with verbose output before committing to the full set","Guarantee starts.bin and the traced binary come from the same unstripped build","On macOS, avoid hardened-runtime settings that strip inserted libraries"],"tags":["tracing","orderfile","preload","macos","diagnostics"],"backgroundTag":null,"analyzedSha":"8c5296ac459e8252d3cd702f3fbcbb0c249d95d5","analyzedAt":"2026-08-16T08:01:58.794Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}