{"record":{"id":"d835fbec427ba54c","repo":"remix-run/react-router","slug":"route-config-file-not-found-at-routeconfigdispl","errorCode":null,"errorMessage":"Route config file not found at \"${routeConfigDisplayPath}\".","messagePattern":"Route config file not found at \"(.+?)\"\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/react-router-dev/config/config.ts","lineNumber":643,"sourceCode":"      `Could not find a root route module in the app directory as \"${rootRouteDisplayPath}\"`,\n    );\n  }\n\n  let routes: RouteManifest;\n  let routeConfig: RouteConfigEntry[] = [];\n\n  if (skipRoutes) {\n    routes = {};\n  } else {\n    let routeConfigFile = findEntry(appDirectory, \"routes\");\n\n    try {\n      if (!routeConfigFile) {\n        let routeConfigDisplayPath = Path.relative(\n          root,\n          Path.join(appDirectory, \"routes.ts\"),\n        );\n        return err(\n          `Route config file not found at \"${routeConfigDisplayPath}\".`,\n        );\n      }\n\n      setAppDirectory(appDirectory);\n      let routeConfigExport = (\n        await viteRunnerContext.runner.import(\n          Path.join(appDirectory, routeConfigFile),\n        )\n      ).default;\n      let result = validateRouteConfig({\n        routeConfigFile,\n        routeConfig: await routeConfigExport,\n      });\n\n      if (!result.valid) {\n        return err(result.message);\n      }","sourceCodeStart":625,"sourceCodeEnd":661,"githubUrl":"https://github.com/remix-run/react-router/blob/6beaca39526d5716c3c112ebb0782765baa5a9ce/packages/react-router-dev/config/config.ts#L625-L661","documentation":"Unless `skipRoutes` is set, `readConfig` requires a route config file in the app directory (`routes.ts` / `routes.tsx` / etc. found via `findEntry(appDirectory, \"routes\")`). When none exists it reports the expected display path (default `app/routes.ts`) — in Framework Mode this file (or `routes/` via fs-routes referenced from it) is the single source of route configuration.","triggerScenarios":"A Framework Mode project without `app/routes.ts`; the file renamed (e.g. `router.ts`) so `findEntry` cannot match it; `appDirectory` pointing to a folder that lacks the file.","commonSituations":"Manual project scaffolding that skipped the template; accidentally deleting `routes.ts` while reorganizing; switching `appDirectory` (e.g. to `src`) without moving the route config; git merge conflicts resolving in deletion.","solutions":["Create `app/routes.ts` exporting a default `RouteConfig` (commonly `flatRoutes()` from `@react-router/fs-routes`).","If it exists under a different name, rename it to `routes.ts`.","Verify `appDirectory` in `react-router.config.ts` points at the directory containing it.","Re-run the dev server or build."],"exampleFix":"// before: app/routes.ts missing -> \"Route config file not found at \\\"app/routes.ts\\\".\"\n\n// after: create app/routes.ts\nimport { type RouteConfig } from \"@react-router/dev/routes\";\nimport { flatRoutes } from \"@react-router/fs-routes\";\n\nexport default flatRoutes() satisfies RouteConfig;","handlingStrategy":"validation","validationCode":"import fs from \"node:fs\";\nimport path from \"node:path\";\nconst appDir = path.resolve(process.cwd(), \"app\");\nconst hasRoutes = [\"routes.ts\", \"routes.tsx\", \"routes.js\", \"routes.jsx\"].some((f) =>\n  fs.existsSync(path.join(appDir, f)),\n);\nif (!hasRoutes) throw new Error(`Missing route config file in ${appDir}`);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Commit app/routes.ts from day one, even if it starts as an empty array.","When renaming, keep the base name 'routes' — findEntry matches on it.","In CI, assert the app directory contains both root.* and routes.* before building."],"tags":["config","routes","file-not-found","framework-mode","build"],"backgroundTag":"missing-route-config","analyzedSha":"6beaca39526d5716c3c112ebb0782765baa5a9ce","analyzedAt":"2026-08-18T18:04:14.938Z","contentChangedAt":"2026-08-18T18:04:14.938Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}