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

  1. Create `app/routes.ts` exporting a default `RouteConfig` (commonly `flatRoutes()` from `@react-router/fs-routes`).
  2. If it exists under a different name, rename it to `routes.ts`.
  3. Verify `appDirectory` in `react-router.config.ts` points at the directory containing it.
  4. 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

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


AI-assisted analysis of remix-run/react-router@6beaca3952 (2026-08-18). Data as JSON: /api/errors/d835fbec427ba54c. Report an issue: GitHub.