{"record":{"id":"e56799b50ed10654","repo":"vercel/next.js","slug":"samples-must-be-at-least-1-got-samples","errorCode":null,"errorMessage":"--samples must be at least 1, got ${samples}","messagePattern":"--samples must be at least 1, got (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/client-trace.ts","lineNumber":175,"sourceCode":"    }\n  }\n\n  const routes = (args.get('routes') ?? '/,/dashboard,/docs,/blog,/tailwind')\n    .split(',')\n    .map((route) => route.trim())\n    .filter(Boolean)\n  if (routes.length === 0) {\n    throw new Error('--routes cannot be empty')\n  }\n  for (const route of routes) {\n    if (!route.startsWith('/')) {\n      throw new Error(`Each route must start with '/': ${route}`)\n    }\n  }\n\n  const samples = parseNumberArg(args, 'samples', 3)\n  if (samples < 1) {\n    throw new Error(`--samples must be at least 1, got ${samples}`)\n  }\n  // CDP rejects rates below 1 (1 = no throttling).\n  const cpuThrottle = parseNumberArg(args, 'cpu-throttle', 4)\n  if (cpuThrottle < 1) {\n    throw new Error(`--cpu-throttle must be at least 1, got ${cpuThrottle}`)\n  }\n\n  const timestamp = new Date().toISOString().replace(/[:.]/g, '-')\n\n  return {\n    appDir: resolve(REPO_ROOT, args.get('app-dir') ?? 'bench/basic-app'),\n    routes,\n    samples,\n    cpuThrottle,\n    build: parseBoolean(args.get('build') ?? 'false'),\n    startServer: parseBoolean(args.get('start-server') ?? 'true'),\n    port: parseNumberArg(args, 'port', 3199),\n    timeoutMs: parseNumberArg(args, 'timeout-ms', 30_000),","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/client-trace.ts#L157-L193","documentation":"Thrown by parseCli when --samples is less than 1. The tracer collects per-route performance traces and needs at least one sample per route to produce any output; zero or negative samples would yield an empty trace file and meaningless aggregates.","triggerScenarios":"Passing --samples=0, --samples=-1, or --samples=0.5 (which floors to 0 in some downstream logic).","commonSituations":"A script defaults samples to 0 when unset; a typo; misunderstanding that 1 is the minimum.","solutions":["Pass --samples=1 or higher (default is 3).","For more stable traces, increase samples rather than lowering below 1."],"exampleFix":"// before\n--samples=0\n// after\n--samples=3","handlingStrategy":"validation","validationCode":"const samples = Math.max(1, parseNumberArg(args, 'samples', 3))","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Leave --samples at the default (3) unless you need more.","Never pass 0 or negative values."],"tags":["cli","validation"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}