{"record":{"id":"3354e0625f21877e","repo":"remix-run/remix","slug":"rmx-route-map-loader-failed","errorCode":"RMX_ROUTE_MAP_LOADER_FAILED","errorMessage":"Route-map loader failed","messagePattern":"Route-map loader failed","errorType":"error_code","errorClass":"CliError","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/errors.ts","lineNumber":108,"sourceCode":"    title: 'Missing target directory',\n    fix: 'Pass a target directory, for example `remix new my-remix-app`.',\n  },\n  projectRootNotFound: {\n    code: 'RMX_PROJECT_ROOT_NOT_FOUND',\n    title: 'Could not find a project root',\n    fix: 'Run this command inside a Remix project.',\n  },\n  remixConfigNotFound: {\n    code: 'RMX_CONFIG_NOT_FOUND',\n    title: 'Remix configuration not found',\n    fix: 'Check the --config path and try again.',\n  },\n  remoteSkillDataMissing: {\n    code: 'RMX_REMOTE_SKILL_DATA_MISSING',\n    title: 'Could not find remote Remix skill data',\n  },\n  routeMapLoaderFailed: {\n    code: 'RMX_ROUTE_MAP_LOADER_FAILED',\n    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: {","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/errors.ts#L90-L126","documentation":"The Remix CLI could not execute the route-map loader used to read your route configuration. The CLI runs app/routes.ts through a loader subprocess to extract the exported `routes` value; if that subprocess fails to start or exits abnormally, this error is thrown. It is a CLI-side configuration error, not a runtime error in your app.","triggerScenarios":"Running CLI commands (e.g. `remix routes` or dev/build flows that need the route map) when app/routes.ts is missing, does not export a named `routes` value, or throws/segfaults during execution of the loader subprocess.","commonSituations":"A fresh non-Remix directory, an app/routes.ts that imports modules failing at load time (missing env vars, top-level side effects), or renaming/removing the `routes` export during a refactor.","solutions":["Check app/routes.ts exists and exports `export const routes` (or a route config array/map).","Remove top-level side effects or failing imports from app/routes.ts (e.g. code needing env vars or DOM APIs).","Run `npx tsx app/routes.ts` (or equivalent) locally to confirm the file loads without throwing.","Verify you are running the CLI from the app root so app/routes.ts resolves."],"exampleFix":"// before\n// app/routes.ts\nexport default routes // no named export\n\n// after\n// app/routes.ts\nexport const routes = [\n  { path: '/', file: 'routes/index.tsx' },\n] satisfies RouteConfig","handlingStrategy":"validation","validationCode":"import { access } from 'node:fs/promises'\n\nasync function routesFileValid(dir: string) {\n  try {\n    await access(path.join(dir, 'app/routes.ts'))\n    return true\n  } catch {\n    return false\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await runRouteMapCommand()\n} catch (error) {\n  if (error instanceof CliError && error.code === 'RMX_ROUTE_MAP_LOADER_FAILED') {\n    // guide user to fix app/routes.ts\n  }\n  throw error\n}","preventionTips":["Keep app/routes.ts side-effect free.","Always export a named `routes` value.","Run CLI commands from the app root."],"tags":["cli","routes","config"],"backgroundTag":"route-config-invalid","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}