remix-run/react-router · error
Route config file not found at "${routeConfigDisplayPath}".
Error message
Route config file not found at "${routeConfigDisplayPath}". What it means
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.
Source
Thrown at packages/react-router-dev/config/config.ts:643
`Could not find a root route module in the app directory as "${rootRouteDisplayPath}"`,
);
}
let routes: RouteManifest;
let routeConfig: RouteConfigEntry[] = [];
if (skipRoutes) {
routes = {};
} else {
let routeConfigFile = findEntry(appDirectory, "routes");
try {
if (!routeConfigFile) {
let routeConfigDisplayPath = Path.relative(
root,
Path.join(appDirectory, "routes.ts"),
);
return err(
`Route config file not found at "${routeConfigDisplayPath}".`,
);
}
setAppDirectory(appDirectory);
let routeConfigExport = (
await viteRunnerContext.runner.import(
Path.join(appDirectory, routeConfigFile),
)
).default;
let result = validateRouteConfig({
routeConfigFile,
routeConfig: await routeConfigExport,
});
if (!result.valid) {
return err(result.message);
}View on GitHub (pinned to 6beaca3952)
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.
Example fix
// before: app/routes.ts missing -> "Route config file not found at \"app/routes.ts\"."
// after: create app/routes.ts
import { type RouteConfig } from "@react-router/dev/routes";
import { flatRoutes } from "@react-router/fs-routes";
export default flatRoutes() satisfies RouteConfig; Defensive patterns
Strategy: validation
Validate before calling
import fs from "node:fs";
import path from "node:path";
const appDir = path.resolve(process.cwd(), "app");
const hasRoutes = ["routes.ts", "routes.tsx", "routes.js", "routes.jsx"].some((f) =>
fs.existsSync(path.join(appDir, f)),
);
if (!hasRoutes) throw new Error(`Missing route config file in ${appDir}`); Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Could not find a root route module in the app directory as "
- Route config in "${routeConfigFile}" is invalid.
- React Router presets must have a `name` property defined.
- Could not find package.json in ${rootDirectory} or any of it
- Unable to define routes with duplicate route id: "${id}"
AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18).
Data as JSON: /api/errors/d835fbec427ba54c.
Report an issue: GitHub.