{"record":{"id":"92f0a762fbd3f420","repo":"vercel/next.js","slug":"inspect-route-not-an-app-router-document-no","errorCode":null,"errorMessage":"[inspect] ${route}: not an App Router document (no __next_f) — this benchmark only measures App Router routes","messagePattern":"\\[inspect\\] (.+?): not an App Router document \\(no __next_f\\) — this benchmark only measures App Router routes","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"bench/render-pipeline/benchmark.ts","lineNumber":440,"sourceCode":"    const gzipBytes = zlib.gzipSync(text).byteLength\n    let inlineFlightBytes = 0\n    let inlineFlightScripts = 0\n    // Inline Flight scripts can carry attributes (e.g. a CSP nonce), so\n    // match any <script ...> tag; the content anchor identifies them.\n    const flightScript = /<script[^>]*>(self\\.__next_f\\.push\\(.*?)<\\/script>/gs\n    for (const match of text.matchAll(flightScript)) {\n      inlineFlightBytes += Buffer.byteLength(match[1])\n      inlineFlightScripts++\n    }\n    if (inlineFlightScripts === 0) {\n      // Every App Router document carries inline Flight scripts; a\n      // silent zero would corrupt the flight-share metric.\n      if (text.includes('__next_f')) {\n        throw new Error(\n          `[inspect] ${route}: document contains __next_f but the extraction regex matched no inline Flight scripts — the markup shape changed, update the regex in inspectRouteDocument`\n        )\n      }\n      throw new Error(\n        `[inspect] ${route}: not an App Router document (no __next_f) — this benchmark only measures App Router routes`\n      )\n    }\n    return {\n      route,\n      bytes,\n      gzipBytes,\n      inlineFlightBytes,\n      inlineFlightShare: bytes > 0 ? inlineFlightBytes / bytes : 0,\n      inlineFlightScripts,\n    }\n  } finally {\n    clearTimeout(timeout)\n  }\n}\n\n// Closed-loop load generator: each worker issues the next request only after\n// the current one completes. This means throughput numbers are accurate for","sourceCodeStart":422,"sourceCodeEnd":458,"githubUrl":"https://github.com/vercel/next.js/blob/0ae8c72462952df163f1b1e0726641bc5b40dc93/bench/render-pipeline/benchmark.ts#L422-L458","documentation":"Thrown by inspectRouteDocument in the render-pipeline server benchmark when the fetched HTML for a route contains no inline Flight script (no self.__next_f.push(...) blocks). The benchmark only measures App Router routes, whose server-rendered documents always embed Flight data as inline scripts; a document without them is a Pages Router route, a static 404, a redirect, or otherwise not representative. Refusing the route prevents the flight-share metric from being silently zeroed out and corrupting the A/B comparison.","triggerScenarios":"Pointing --routes at a Pages Router page (e.g. pages/about.js), a route that returns a 404 or redirect, a static asset URL, or an app route that throws during SSR so the error page (no __next_f) is served. Also triggered if a custom error boundary or not-found page is rendered instead of the App Router shell.","commonSituations":"Misconfigured --routes list mixing app/ and pages/ paths; the fixture app was built without the app directory; a dynamic route segment returned notFound(); the dev server answered with a compile-error overlay page instead of the real document.","solutions":["Confirm every route in --routes resolves to an app/ App Router page by checking the document HTML contains self.__next_f via curl before running the benchmark.","If the route is genuinely a Pages Router route, exclude it from this benchmark — it cannot be measured here.","Check the server logs / the fetched HTML body for a 404, redirect, or error overlay and fix the underlying route handler.","Verify the fixture app was built (next build) and that the route segment renders the App Router shell, not a static or error page."],"exampleFix":"// before: route is a pages-router page\n--routes=/,/about\n// about.js lives in pages/, not app/\n\n// after: only app-router routes\n--routes=/,/dashboard,/docs","handlingStrategy":"validation","validationCode":"// Before benchmarking a route, verify it is an App Router document\nasync function isAppRouterRoute(url: string): Promise<boolean> {\n  const res = await fetch(url, { cache: 'no-store' })\n  if (!res.ok) return false\n  const html = await res.text()\n  return html.includes('self.__next_f')\n}\n\nfor (const route of routes) {\n  if (!(await isAppRouterRoute(base + route))) {\n    throw new Error(`${route} is not an App Router route; remove it from --routes`)\n  }\n}","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Maintain the --routes list against actual app/ directory entries.","Smoke-test each route with curl checking for self.__next_f before running the benchmark.","Rebuild the fixture after any route change or branch switch."],"tags":["benchmark","app-router","validation","render-pipeline"],"analyzedSha":"0ae8c72462952df163f1b1e0726641bc5b40dc93","analyzedAt":"2026-08-06T19:44:29.143Z","schemaVersion":2},"datasetVersion":"2026-08-07T02:17:10.218Z"}