remix-run/remix · error · Error

Route-map loader returned a route node without a valid name.

Error message

Route-map loader returned a route node without a valid name.

What it means

Every route node must carry string `key` and `name` fields. If either is missing or not a string, this error is thrown during tree validation in the main process.

Source

Thrown at packages/cli/src/lib/route-map.ts:247

  if (!Array.isArray(value)) {
    throw new Error('Route-map loader returned an invalid tree.')
  }

  return value.map((entry) => assertRawRouteTreeNode(entry))
}

function assertRawRouteTreeNode(value: unknown): RawRouteTreeNode {
  if (typeof value !== 'object' || value == null) {
    throw new Error('Route-map loader returned an invalid route node.')
  }

  let key = Reflect.get(value, 'key')
  let name = Reflect.get(value, 'name')
  let kind = Reflect.get(value, 'kind')
  let children = Reflect.get(value, 'children')

  if (typeof key !== 'string' || typeof name !== 'string') {
    throw new Error('Route-map loader returned a route node without a valid name.')
  }

  if (kind !== 'group' && kind !== 'route') {
    throw new Error(`Route-map loader returned an unknown node kind for "${name}".`)
  }

  if (!Array.isArray(children)) {
    throw new Error(`Route-map loader returned invalid children for "${name}".`)
  }

  if (kind === 'group') {
    return {
      children: children.map((child) => assertRawRouteTreeNode(child)),
      key,
      kind,
      name,
    }
  }

View on GitHub (pinned to 9696913134)

Solutions

  1. Reinstall to a consistent remix/CLI version set
  2. Fix test fixtures to include `key` and `name` strings on every node
  3. Verify with `pnpm why remix` that only one version is installed
Defensive patterns

Strategy: type-guard

Validate before calling

tree.every(n => typeof n.key === 'string' && typeof n.name === 'string')

Type guard

function hasNames(n: unknown): n is { key: string; name: string } {
  return typeof (n as any)?.key === 'string' && typeof (n as any)?.name === 'string'
}

Prevention

When it happens

Trigger: A tree node where Reflect.get(value,'key') or 'name' returns a non-string — again normally a worker/spawner version mismatch or malformed mock, since real worker output always includes these.

Common situations: Partial upgrade of the CLI leaving an older worker emitting a different node schema; test fixtures missing key/name fields.

Related errors


AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27). Data as JSON: /api/errors/320cfc499cdfb989. Report an issue: GitHub.