{"record":{"id":"e556160f32bf03c7","repo":"vercel/next.js","slug":"command-failed-command-args-join-exit-e55616","errorCode":null,"errorMessage":"Command failed: ${command} ${args.join(' ')} (exit ${code})","messagePattern":"Command failed: (.+?) (.+?) \\(exit (.+?)\\)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/client-trace.ts","lineNumber":216,"sourceCode":"        `bench/render-pipeline/artifacts/${timestamp}-client`\n    ),\n    jsonOut: args.get('json-out'),\n  }\n}\n\nasync function runCommand(\n  command: string,\n  args: string[],\n  cwd: string\n): Promise<void> {\n  const child = spawn(command, args, {\n    cwd,\n    env: { ...process.env, NEXT_TELEMETRY_DISABLED: '1' },\n    stdio: 'inherit',\n  })\n  const [code] = (await once(child, 'exit')) as [number | null]\n  if (code !== 0) {\n    throw new Error(\n      `Command failed: ${command} ${args.join(' ')} (exit ${code})`\n    )\n  }\n}\n\nasync function waitForServerReady(\n  url: string,\n  timeoutMs: number,\n  serverDied?: () => boolean\n): Promise<void> {\n  const start = performance.now()\n  while (performance.now() - start < timeoutMs) {\n    // Without this check, a server that dies on startup (e.g. EADDRINUSE\n    // against a stale server on the same port) is indistinguishable from\n    // a slow one — worse, a 200 from whatever else owns the port would\n    // pass, and the run would silently measure the wrong server.\n    if (serverDied?.()) {\n      throw new Error(","sourceCodeStart":198,"sourceCodeEnd":234,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/client-trace.ts#L198-L234","documentation":"Thrown by runCommand after a spawned child process (node, next build, a fixture generator) exits with a non-zero code. The error echoes the full command, args, and exit code so the underlying failure is visible. This wraps build/setup steps the tracer depends on.","triggerScenarios":"next build fails (compile error, missing dependency); a fixture graph generator script errors; the node binary path is wrong; a build step is interrupted.","commonSituations":"Running client-trace with --build=true against a fixture with a syntax error; the generator script (generate-client-graph.mjs) throws; node version mismatch.","solutions":["Re-run the exact failing command (shown in the message) manually to see the full stderr.","Fix the underlying compile/build error in the fixture or generator.","If the build is already done and current, drop --build=true to skip rebuilding.","Confirm the node and next binaries are on PATH and the right version."],"exampleFix":"// before: build fails due to fixture error\nnode packages/next/dist/bin/next build  # shows the real error\n\n// after: fix the error, then trace\npnpm bench:render-pipeline:client --build=false","handlingStrategy":"try-catch","validationCode":"null","typeGuard":"null","tryCatchPattern":"try {\n  await runCommand('node', [NEXT_BIN, 'build'], appDir)\n} catch (e) {\n  // The message includes the failing command; run it manually for full output\n  console.error('Build step failed — re-run manually:', (e as Error).message)\n  throw e\n}","preventionTips":["Run build steps manually first to surface real errors.","Use --build=false when the fixture is already built and current.","Keep node and next versions consistent across the team."],"tags":["cli","subprocess","build"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}