{"record":{"id":"bf8b8547c51d21bb","repo":"remix-run/remix","slug":"route-map-loader-returned-an-invalid-route-leaf-fo","errorCode":null,"errorMessage":"Route-map loader returned an invalid route leaf for \"${name}\".","messagePattern":"Route-map loader returned an invalid route leaf for \"(.+?)\"\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/route-map.ts","lineNumber":271,"sourceCode":"\n  if (!Array.isArray(children)) {\n    throw new Error(`Route-map loader returned invalid children for \"${name}\".`)\n  }\n\n  if (kind === 'group') {\n    return {\n      children: children.map((child) => assertRawRouteTreeNode(child)),\n      key,\n      kind,\n      name,\n    }\n  }\n\n  let method = Reflect.get(value, 'method')\n  let pattern = Reflect.get(value, 'pattern')\n\n  if (typeof method !== 'string' || typeof pattern !== 'string') {\n    throw new Error(`Route-map loader returned an invalid route leaf for \"${name}\".`)\n  }\n\n  return {\n    children: [],\n    key,\n    kind,\n    method,\n    name,\n    pattern,\n  }\n}\n\nasync function findRemixAppRoot(startDir: string): Promise<string> {\n  let appRoot = await findAppRoot(startDir, 'app/routes.ts')\n\n  if (appRoot == null) {\n    throw routesFileNotFound(startDir)\n  }","sourceCodeStart":253,"sourceCodeEnd":289,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/route-map.ts#L253-L289","documentation":"For 'route' kind nodes, `method` and `pattern` must both be strings; they define the HTTP route leaf. This is the last leaf-level validation of the worker payload.","triggerScenarios":"A route node whose method or pattern is missing/non-string, e.g. `{ kind: 'route', name: 'home' }` with no method/pattern — schema drift or incomplete mock data.","commonSituations":"Fixture authors omitting method/pattern; mixed-version installs where the leaf schema changed between releases.","solutions":["Align remix package versions and do a clean install","Complete route fixtures with string `method` and `pattern` fields","If it persists on a clean install, report as a CLI bug"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"tree.filter(n => n.kind === 'route').every(n => typeof n.method === 'string' && typeof n.pattern === 'string')","typeGuard":"function isRouteLeaf(n: unknown): n is { kind: 'route'; method: string; pattern: string } {\n  let r = n as any\n  return r?.kind === 'route' && typeof r.method === 'string' && typeof r.pattern === 'string'\n}","tryCatchPattern":null,"preventionTips":["Complete route fixtures with method and pattern","Avoid partial-upgrade installs that mix schemas","Smoke-test route loading in CI"],"tags":["routes","worker","internal","validation"],"backgroundTag":"invalid-worker-response","analyzedSha":"9696913134be3a4423513d2775f7b31d6917c049","analyzedAt":"2026-08-27T19:55:01.024Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}