{"record":{"id":"6820b4d8c0cb572d","repo":"remix-run/remix","slug":"route-map-loader-returned-an-invalid-route-node","errorCode":null,"errorMessage":"Route-map loader returned an invalid route node.","messagePattern":"Route-map loader returned an invalid route node\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/lib/route-map.ts","lineNumber":238,"sourceCode":"      kind: 'directory',\n      path: directory.directoryPath,\n    }\n  }\n\n  throw routeOwnerPlanUnresolved(rawNode.name)\n}\n\nfunction assertRawRouteTree(value: unknown): RawRouteTreeNode[] {\n  if (!Array.isArray(value)) {\n    throw new Error('Route-map loader returned an invalid tree.')\n  }\n\n  return value.map((entry) => assertRawRouteTreeNode(entry))\n}\n\nfunction assertRawRouteTreeNode(value: unknown): RawRouteTreeNode {\n  if (typeof value !== 'object' || value == null) {\n    throw new Error('Route-map loader returned an invalid route node.')\n  }\n\n  let key = Reflect.get(value, 'key')\n  let name = Reflect.get(value, 'name')\n  let kind = Reflect.get(value, 'kind')\n  let children = Reflect.get(value, 'children')\n\n  if (typeof key !== 'string' || typeof name !== 'string') {\n    throw new Error('Route-map loader returned a route node without a valid name.')\n  }\n\n  if (kind !== 'group' && kind !== 'route') {\n    throw new Error(`Route-map loader returned an unknown node kind for \"${name}\".`)\n  }\n\n  if (!Array.isArray(children)) {\n    throw new Error(`Route-map loader returned invalid children for \"${name}\".`)\n  }","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/remix-run/remix/blob/9696913134be3a4423513d2775f7b31d6917c049/packages/cli/src/lib/route-map.ts#L220-L256","documentation":"Each element of the worker's route tree must be a non-null object. This is the first shape assertion on every node; failing means the payload is structurally corrupt rather than a config typo.","triggerScenarios":"An entry in the tree array is null, a string, a number, or undefined — typically from a mismatched worker version or a hand-crafted/mocked payload.","commonSituations":"Version skew between CLI packages after a partial upgrade; tests stubbing the worker with `[]` containing primitives.","solutions":["Align remix package versions and reinstall node_modules","Regenerate real worker output instead of hand-writing fixtures","Report upstream if it reproduces with a clean install"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!Array.isArray(tree) || tree.some(n => typeof n !== 'object' || n === null)) {\n  throw new Error('malformed tree')\n}","typeGuard":"function isNode(v: unknown): v is Record<string, unknown> {\n  return typeof v === 'object' && v !== null\n}","tryCatchPattern":null,"preventionTips":["Keep CLI and worker from the same release","Don't hand-write tree fixtures; record real output","Validate payloads at the process boundary"],"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"}