{"record":{"id":"100c8fea6624c8d0","repo":"vercel/next.js","slug":"no-artifact-run-found-in-requested-expected-a","errorCode":null,"errorMessage":"No artifact run found in ${requested}. Expected a results.json file.","messagePattern":"No artifact run found in (.+?)\\. Expected a results\\.json file\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/analyze-profiles.ts","lineNumber":112,"sourceCode":"  const requestedResults = resolve(requested, 'results.json')\n  if (await exists(requestedResults)) {\n    return requested\n  }\n\n  const entries = await readdir(requested, { withFileTypes: true })\n  const dirs = entries.filter((entry) => entry.isDirectory())\n  const runs: Array<{ dir: string; mtimeMs: number }> = []\n\n  for (const dirent of dirs) {\n    const dir = resolve(requested, dirent.name)\n    const resultsPath = resolve(dir, 'results.json')\n    if (!(await exists(resultsPath))) continue\n    const stats = await stat(resultsPath)\n    runs.push({ dir, mtimeMs: stats.mtimeMs })\n  }\n\n  if (runs.length === 0) {\n    throw new Error(\n      `No artifact run found in ${requested}. Expected a results.json file.`\n    )\n  }\n\n  runs.sort((a, b) => b.mtimeMs - a.mtimeMs)\n  return runs[0].dir\n}\n\nfunction toPercent(part: number, total: number): string {\n  if (total <= 0) return '0.00%'\n  return `${((part / total) * 100).toFixed(2)}%`\n}\n\nfunction toMs(us: number): string {\n  return `${(us / 1000).toFixed(1)}ms`\n}\n\nfunction sortTop(","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/analyze-profiles.ts#L94-L130","documentation":"Thrown by resolveArtifactRunDir (analyze-profiles.ts:112) when neither the requested path itself contains results.json nor does any of its subdirectories. The resolver first checks <requested>/results.json; if missing, it scans child dirs for ones containing results.json and picks the most recently modified; if none found, it errors. So this means there are no benchmark run artifacts at the given location.","triggerScenarios":"Running analyze with --artifact-dir pointing at a path that has no results.json directly and no run subdirectories containing results.json; running analyze before ever running the benchmark; passing a relative path that resolves somewhere unexpected (it is resolve()'d against REPO_ROOT, not cwd).","commonSituations":"First-time use: no benchmark has been run yet, so bench/render-pipeline/artifacts is empty/absent; pointing --artifact-dir at the artifacts root but the runs were written elsewhere; a typo in the path; runs were cleaned up; relative path misinterpretation because the resolver joins against REPO_ROOT.","solutions":["Run the benchmark first to produce artifacts: `pnpm bench:render-pipeline --scenario=e2e --stream-mode=node`, which writes results.json under bench/render-pipeline/artifacts/<timestamp>/.","Omit --artifact-dir so the resolver auto-picks the latest run under the default artifacts root.","If passing --artifact-dir, give an absolute path or a path relative to the repo root (not cwd), and confirm it contains (or is a parent of dirs containing) results.json.","Check that previous runs weren't deleted; re-run if artifacts dir is empty."],"exampleFix":"// before\n//   pnpm bench:render-pipeline:analyze --artifact-dir=./out\n\n// after — run the benchmark to create artifacts, then analyze with no arg (auto-latest)\n//   pnpm bench:render-pipeline --scenario=e2e --stream-mode=node\n//   pnpm bench:render-pipeline:analyze","handlingStrategy":"validation","validationCode":"import { existsSync } from 'node:fs'\nimport { resolve } from 'node:path'\n\nfunction hasResultsJsonsomewhere(root: string): boolean {\n  if (existsSync(resolve(root, 'results.json'))) return true\n  // shallow scan of immediate subdirs\n  return false\n}\n// cheaper: just confirm the benchmark has been run once:\n// ls bench/render-pipeline/artifacts/*/results.json","typeGuard":"function isArtifactRunPath(p: string): boolean {\n  return existsSync(resolve(p, 'results.json'))\n}","tryCatchPattern":"try {\n  const runDir = await resolveArtifactRunDir(artifactDirArg)\n} catch (err) {\n  if (err instanceof Error && err.message.startsWith('No artifact run found')) {\n    console.error('Run the benchmark first: pnpm bench:render-pipeline --scenario=e2e --stream-mode=node')\n    process.exit(2)\n  }\n  throw err\n}","preventionTips":["Run the benchmark at least once before analyzing; artifacts are produced under bench/render-pipeline/artifacts/<timestamp>/.","Pass --artifact-dir as an absolute path or relative-to-repo-root (it's resolve()'d against REPO_ROOT).","Omit --artifact-dir to auto-pick the latest run.","Don't delete artifacts/ between runs if you want history."],"tags":["analyze-profiles","artifacts","filesystem","missing-file","benchmark"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}