remix-run/remix · error · CliError

RMX_ROUTES_FILE_NOT_FOUND

RMX_ROUTES_FILE_NOT_FOUND

Error message

Could not find app/routes.ts

What it means

The CLI command you ran requires a Remix route configuration, but app/routes.ts was not found relative to the current working directory. It is the guard error emitted before any route-map loading is attempted.

Source

Thrown at packages/cli/src/lib/errors.ts:127

    title: 'Route-map loader failed',
    fix: 'Check app/routes.ts and make sure it exports a named `routes` value with a valid route map.',
  },
  routeMapLoaderInvalidJson: {
    code: 'RMX_ROUTE_MAP_LOADER_INVALID_JSON',
    title: 'Route-map loader returned invalid JSON',
    fix: 'Check app/routes.ts and make sure route-map loading does not write extra output.',
  },
  routeMapLoaderSignal: {
    code: 'RMX_ROUTE_MAP_LOADER_SIGNAL',
    title: 'Route-map loader exited from a signal',
    fix: 'Check app/routes.ts for side effects or runtime issues and try again.',
  },
  routeOwnerPlanUnresolved: {
    code: 'RMX_ROUTE_OWNER_PLAN_UNRESOLVED',
    title: 'Could not resolve a route owner plan',
  },
  routesFileNotFound: {
    code: 'RMX_ROUTES_FILE_NOT_FOUND',
    title: 'Could not find app/routes.ts',
    fix: 'Run this command inside a Remix app that has app/routes.ts.',
  },
  targetDirectoryNotEmpty: {
    code: 'RMX_TARGET_DIRECTORY_NOT_EMPTY',
    title: 'Target directory is not empty',
    fix: 'Re-run with --force to continue.',
  },
  targetPathNotDirectory: {
    code: 'RMX_TARGET_PATH_NOT_DIRECTORY',
    title: 'Target path is not a directory',
    fix: 'Choose a directory path for the new app target.',
  },
  unexpectedExtraArgument: {
    code: 'RMX_UNEXPECTED_ARGUMENT',
    title: 'Unexpected extra argument',
    fix: 'Remove the extra argument or run the command with --help.',
  },

View on GitHub (pinned to 9696913134)

Solutions

  1. cd into the directory that contains app/routes.ts and re-run the command.
  2. Create app/routes.ts exporting a named `routes` value if your app lacks one.
  3. Restore the file if it was moved or deleted (check git status).

Example fix

// app/routes.ts
import type { RouteConfig } from '@remix-run/route'

export const routes: RouteConfig = [
  { path: '/', file: 'routes/index.tsx' },
]
Defensive patterns

Strategy: validation

Validate before calling

import { access } from 'node:fs/promises'

try {
  await access('app/routes.ts')
} catch {
  // create it or cd to the app root before running CLI commands
}

Try / catch

try {
  execSync('remix routes')
} catch (error) {
  if (String(error.stdout ?? '').includes('RMX_ROUTES_FILE_NOT_FOUND')) {
    // create app/routes.ts or change cwd
  }
}

Prevention

When it happens

Trigger: Running route-dependent CLI commands from outside the app root, in a project scaffolded without app/routes.ts, or after moving/deleting the file.

Common situations: Running `remix` commands in a monorepo subfolder that is not the app, using a pre-Remix-3 layout, or renaming routes.ts during a migration.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/954e7c6d0e2f9537. Report an issue: GitHub.