{"record":{"id":"f8c01f9c412f134e","repo":"angular/angular-cli","slug":"could-not-find-any-routes-to-prerender","errorCode":null,"errorMessage":"Could not find any routes to prerender.","messagePattern":"Could not find any routes to prerender\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/angular_devkit/build_angular/src/builders/prerender/index.ts","lineNumber":88,"sourceCode":"        indexFile,\n        outputPath,\n        serverBundlePath,\n        zonePackage,\n      } as RoutesExtractorWorkerData,\n      recordTiming: false,\n    });\n\n    const extractedRoutes: string[] = await renderWorker\n      .run({})\n      .finally(() => void renderWorker.destroy());\n\n    for (const route of extractedRoutes) {\n      routes.add(route);\n    }\n  }\n\n  if (routes.size === 0) {\n    throw new Error('Could not find any routes to prerender.');\n  }\n\n  return [...routes];\n}\n\n/**\n * Schedules the server and browser builds and returns their results if both builds are successful.\n */\nasync function _scheduleBuilds(\n  options: PrerenderBuilderOptions,\n  context: BuilderContext,\n): Promise<\n  BuilderOutput & {\n    serverResult?: ServerBuilderOutput;\n    browserResult?: BrowserBuilderOutput;\n  }\n> {\n  const browserTarget = targetFromTargetString(options.browserTarget);","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/angular/angular-cli/blob/bb72145f9ab45aee29f523236b3a25cd0813a841/packages/angular_devkit/build_angular/src/builders/prerender/index.ts#L70-L106","documentation":"getRoutes collects the routes to prerender from builder options (routes, guessFilename, and extracted routes from the build output). If, after merging all sources, the route set is empty, there is nothing to render and the builder throws this error instead of producing an empty prerender output.","triggerScenarios":"Running the prerender builder with no `routes` specified, no `routesFile`, and the application build's extraction (AppShell/route discovery) produced no routes; an empty or misformatted routes file yielding zero parsed routes.","commonSituations":"Forgetting to configure `routes` in angular.json prerender options; a routes file with blank lines/comments only or wrong path; upgrading to application-builder versions where routes must be declared explicitly instead of inferred.","solutions":["Add routes to the prerender target options: `\"routes\": [\"/\", \"/about\"]`.","Provide a routesFile (one route per line) and verify its path and contents.","Check that route discovery/extraction in the app is enabled and emits routes in the build output.","Verify your app's routing actually declares the routes you expect to be discovered."],"exampleFix":"// before (angular.json)\n\"prerender\": { \"builder\": \"@angular-devkit/build-angular:prerender\", \"options\": {} }\n// after\n\"prerender\": {\n  \"builder\": \"@angular-devkit/build-angular:prerender\",\n  \"options\": { \"routes\": [\"/\", \"/products\"] }\n}","handlingStrategy":"validation","validationCode":"const routes = options.routes?.length ? options.routes\n  : options.routesFile ? fs.readFileSync(options.routesFile, 'utf-8').split('\\n').filter(Boolean)\n  : [];\nif (routes.length === 0) {\n  throw new Error('Configure prerender \"routes\" or a non-empty \"routesFile\".');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await ngRun('my-app:prerender');\n} catch (e) {\n  if (e.message.includes('Could not find any routes to prerender')) {\n    console.error('Add \"routes\" or \"routesFile\" to prerender options.');\n  } else throw e;\n}","preventionTips":["Always configure routes or routesFile for the prerender target.","Validate the routes file is non-empty and correctly formatted before building.","Keep route discovery output intact when using application-builder extraction.","Fail fast in CI by checking prerender options exist."],"tags":["prerender","angular","ssr","config"],"backgroundTag":"no-routes-configured","analyzedSha":"bb72145f9ab45aee29f523236b3a25cd0813a841","analyzedAt":"2026-08-30T02:47:34.745Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}