{"record":{"id":"179dab01ffb5ae8c","repo":"vercel/next.js","slug":"missing-next-bin-build-next-js-first-pnpm-f-179dab","errorCode":null,"errorMessage":"Missing ${NEXT_BIN}. Build Next.js first (pnpm --filter=next build).","messagePattern":"Missing (.+?)\\. Build Next\\.js first \\(pnpm --filter=next build\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/client-trace.ts","lineNumber":603,"sourceCode":"    console.log(\n      `    off thread  parse-background=${m.parseBackgroundMs.toFixed(1)}ms`\n    )\n    console.log(\n      `    blocking    longTasks(pre-hydration)=${m.longTasksToHydrated ?? 'n/a'} tbt=${m.blockingTimeToHydratedMs === null ? 'n/a' : `${m.blockingTimeToHydratedMs.toFixed(1)}ms`}`\n    )\n    console.log(\n      `    js          ${formatKb(m.jsTransferBytes)} transferred / ${formatKb(m.jsParsedBytes)} parsed (${m.jsFileCount} files)`\n    )\n  }\n}\n\nasync function main() {\n  const options = parseCli()\n\n  try {\n    await access(NEXT_BIN)\n  } catch {\n    throw new Error(\n      `Missing ${NEXT_BIN}. Build Next.js first (pnpm --filter=next build).`\n    )\n  }\n\n  await mkdir(options.artifactDir, { recursive: true })\n\n  if (options.build) {\n    const generator = resolve(\n      options.appDir,\n      'scripts/generate-client-graph.mjs'\n    )\n    if (existsSync(generator)) {\n      await runCommand('node', [generator], options.appDir)\n    }\n    console.log('[client-trace] building app fixture...')\n    await runCommand('node', [NEXT_BIN, 'build'], options.appDir)\n  }\n","sourceCodeStart":585,"sourceCodeEnd":621,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/client-trace.ts#L585-L621","documentation":"Thrown at the start of client-trace main() when fs.access(NEXT_BIN) fails, meaning the compiled Next.js CLI binary (packages/next/dist/bin/next) does not exist. The tracer needs that binary to build and/or start the fixture app, so a missing build is a hard prerequisite. The message gives the exact build command.","triggerScenarios":"Fresh checkout without building; deleted dist/; switched branches that removed the build; the path constant NEXT_BIN points somewhere unexpected.","commonSituations":"First run in a new clone; ran pnpm clean or rm -rf packages/next/dist; partial build that did not emit the bin.","solutions":["Run pnpm --filter=next build to produce the binary.","If on a fresh checkout or after bootstrap, run pnpm build-all.","Verify packages/next/dist/bin/next exists after building."],"exampleFix":"# before\nls packages/next/dist/bin/next  # missing\n\n# after\npnpm --filter=next build\nls packages/next/dist/bin/next  # exists","handlingStrategy":"validation","validationCode":"import { access, constants } from 'node:fs/promises'\nasync function ensureBuilt() {\n  try { await access(NEXT_BIN, constants.X_OK) }\n  catch { throw new Error(`Missing ${NEXT_BIN}. Run pnpm --filter=next build first.`) }\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Run pnpm --filter=next build (or pnpm build-all) after fresh checkout or branch switch.","Never delete packages/next/dist without rebuilding.","Add a build check at the start of any benchmark script."],"tags":["build","setup","missing-binary"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}