{"record":{"id":"25ea834d4dc70946","repo":"vercel/next.js","slug":"routes-cannot-be-empty-25ea83","errorCode":null,"errorMessage":"--routes cannot be empty","messagePattern":"--routes cannot be empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/client-trace.ts","lineNumber":165,"sourceCode":"  }\n\n  const args = new Map<string, string>()\n  for (const rawArg of rawArgs) {\n    if (!rawArg.startsWith('--')) continue\n    const eq = rawArg.indexOf('=')\n    if (eq === -1) {\n      args.set(rawArg.slice(2), 'true')\n    } else {\n      args.set(rawArg.slice(2, eq), rawArg.slice(eq + 1))\n    }\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, '-')","sourceCodeStart":147,"sourceCodeEnd":183,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/client-trace.ts#L147-L183","documentation":"Thrown by parseCli when the --routes flag, after splitting on commas, trimming, and filtering empty strings, yields zero routes. The client tracer must trace at least one route, so an empty set is rejected immediately rather than producing an empty trace.","triggerScenarios":"Passing --routes= (empty), --routes=,,, (only commas), or --routes=\"   \" (only whitespace).","commonSituations":"An environment variable expanding to empty is interpolated into --routes; a script that builds the routes string produced nothing; user cleared the list intending defaults but passed the empty flag.","solutions":["Omit --routes entirely to use the defaults (/,/dashboard,/docs,/blog,/tailwind).","Provide at least one route path, e.g. --routes=/.","If building the value from a variable, guard for empty before passing the flag."],"exampleFix":"// before\n--routes=\n// after (omit for defaults)\n// no --routes flag","handlingStrategy":"validation","validationCode":"const routesArg = process.env.BENCH_ROUTES ?? ''\nconst routes = routesArg\n  ? routesArg.split(',').map(r => r.trim()).filter(Boolean)\n  : undefined // let CLI default\nif (routesArg && routes.length === 0) {\n  throw new Error('--routes resolved to empty; omit the flag for defaults')\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Omit --routes to accept the documented defaults.","When building --routes from a variable, skip the flag entirely if the value is empty."],"tags":["cli","validation"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}