{"record":{"id":"954e7c6d0e2f9537","repo":"remix-run/remix","slug":"rmx-routes-file-not-found","errorCode":"RMX_ROUTES_FILE_NOT_FOUND","errorMessage":"Could not find app/routes.ts","messagePattern":"Could not find app/routes\\.ts","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/errors.ts","lineNumber":127,"sourceCode":"    title: 'Route-map loader failed',\n    fix: 'Check app/routes.ts and make sure it exports a named `routes` value with a valid route map.',\n  },\n  routeMapLoaderInvalidJson: {\n    code: 'RMX_ROUTE_MAP_LOADER_INVALID_JSON',\n    title: 'Route-map loader returned invalid JSON',\n    fix: 'Check app/routes.ts and make sure route-map loading does not write extra output.',\n  },\n  routeMapLoaderSignal: {\n    code: 'RMX_ROUTE_MAP_LOADER_SIGNAL',\n    title: 'Route-map loader exited from a signal',\n    fix: 'Check app/routes.ts for side effects or runtime issues and try again.',\n  },\n  routeOwnerPlanUnresolved: {\n    code: 'RMX_ROUTE_OWNER_PLAN_UNRESOLVED',\n    title: 'Could not resolve a route owner plan',\n  },\n  routesFileNotFound: {\n    code: 'RMX_ROUTES_FILE_NOT_FOUND',\n    title: 'Could not find app/routes.ts',\n    fix: 'Run this command inside a Remix app that has app/routes.ts.',\n  },\n  targetDirectoryNotEmpty: {\n    code: 'RMX_TARGET_DIRECTORY_NOT_EMPTY',\n    title: 'Target directory is not empty',\n    fix: 'Re-run with --force to continue.',\n  },\n  targetPathNotDirectory: {\n    code: 'RMX_TARGET_PATH_NOT_DIRECTORY',\n    title: 'Target path is not a directory',\n    fix: 'Choose a directory path for the new app target.',\n  },\n  unexpectedExtraArgument: {\n    code: 'RMX_UNEXPECTED_ARGUMENT',\n    title: 'Unexpected extra argument',\n    fix: 'Remove the extra argument or run the command with --help.',\n  },","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/errors.ts#L109-L145","documentation":"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.","triggerScenarios":"Running route-dependent CLI commands from outside the app root, in a project scaffolded without app/routes.ts, or after moving/deleting the file.","commonSituations":"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.","solutions":["cd into the directory that contains app/routes.ts and re-run the command.","Create app/routes.ts exporting a named `routes` value if your app lacks one.","Restore the file if it was moved or deleted (check git status)."],"exampleFix":"// app/routes.ts\nimport type { RouteConfig } from '@remix-run/route'\n\nexport const routes: RouteConfig = [\n  { path: '/', file: 'routes/index.tsx' },\n]","handlingStrategy":"validation","validationCode":"import { access } from 'node:fs/promises'\n\ntry {\n  await access('app/routes.ts')\n} catch {\n  // create it or cd to the app root before running CLI commands\n}","typeGuard":null,"tryCatchPattern":"try {\n  execSync('remix routes')\n} catch (error) {\n  if (String(error.stdout ?? '').includes('RMX_ROUTES_FILE_NOT_FOUND')) {\n    // create app/routes.ts or change cwd\n  }\n}","preventionTips":["Run CLI commands from the app root.","Scaffold with the official template so routes.ts exists."],"tags":["cli","file-not-found","routes"],"backgroundTag":"missing-config-file","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}