{"record":{"id":"79d1f716dbd2ff14","repo":"remix-run/remix","slug":"missing-app-routes-ts-path","errorCode":null,"errorMessage":"Missing app/routes.ts path.","messagePattern":"Missing app/routes\\.ts path\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/load-route-map-worker.ts","lineNumber":19,"sourceCode":"import * as process from 'node:process'\nimport { pathToFileURL } from 'node:url'\n\nimport type { RawRouteTreeNode } from './route-map.ts'\n\nvoid run().catch((error: unknown) => {\n  if (error instanceof Error) {\n    process.stderr.write(`${error.message}\\n`)\n  } else {\n    process.stderr.write(`${String(error)}\\n`)\n  }\n\n  setExitCode(1)\n})\n\nasync function run(): Promise<void> {\n  let routesFile = process.argv[2]\n  if (typeof routesFile !== 'string' || routesFile.length === 0) {\n    throw new Error('Missing app/routes.ts path.')\n  }\n\n  let tree = await loadRawRouteTree(routesFile)\n  process.stdout.write(JSON.stringify(tree))\n}\n\nasync function loadRawRouteTree(routesFile: string): Promise<RawRouteTreeNode[]> {\n  let routeModule: object = await import(pathToFileURL(routesFile).href)\n\n  if (!('routes' in routeModule)) {\n    throw new Error(`Route module ${routesFile} must export a named \"routes\" value.`)\n  }\n\n  return normalizeRouteGroup(routeModule.routes, [], new Map())\n}\n\nfunction normalizeRouteGroup(\n  value: unknown,","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/load-route-map-worker.ts#L1-L37","documentation":"The route-map worker thread is invoked as `node load-route-map-worker.js <path-to-app/routes.ts>`; if argv[2] is missing or empty it cannot load the route config and exits. This is an internal invocation contract error, not a user config error.","triggerScenarios":"Spawning the worker without the routesFile argument or with an empty string; only happens if the spawning code in route-map.ts is broken or the worker script is run manually without args.","commonSituations":"Manually executing the worker file to debug route loading; a fork/spawn bug or version mismatch between the CLI and the worker bundle.","solutions":["Do not run the worker directly; invoke the CLI command that spawns it (e.g. `remix routes` or dev/build)","If spawning programmatically, pass the absolute path to app/routes.ts as the second CLI argument","Reinstall/upgrade the CLI so the worker and spawner versions match"],"exampleFix":"# before\nnode node_modules/remix/cli/lib/load-route-map-worker.js\n# after\nnpx remix routes","handlingStrategy":"validation","validationCode":"if (process.argv[2] == null || process.argv[2] === '') {\n  console.error('usage: worker <app/routes.ts>')\n  process.exit(1)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never invoke the worker script manually; use the CLI","Pass an absolute path when spawning programmatically","Keep CLI package versions in sync"],"tags":["cli","worker","routes","internal"],"backgroundTag":"missing-cli-argument","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}