remix-run/remix · error · Error
Route-map loader returned invalid children for
Error message
Route-map loader returned invalid children for "${name}". What it means
The `children` field of every node (both groups and route leaves) must be an array. This error fires when children is missing or not an array during tree validation.
Solutions
- Reinstall dependencies to align remix versions
- Add `children: []` to leaf nodes in test fixtures
- Regenerate the tree from the real worker
Defensive patterns
Strategy: validation
Validate before calling
tree.every(n => Array.isArray((n as any).children))
Type guard
function hasChildren(n: unknown): n is { children: unknown[] } {
return Array.isArray((n as any)?.children)
} Prevention
- Include children: [] on leaf fixtures
- Regenerate fixtures with the real worker
- Keep package versions aligned
When it happens
Trigger: A node where children is undefined/null/object — typically schema drift between worker and validator versions, or hand-built test data omitting children.
Common situations: Version mismatch after partial upgrade; fixtures that model leaves without a children array.
Related errors
- Route-map loader returned a route node without a valid name.
- Route-map loader returned an invalid route leaf for
- Route-map loader returned an invalid route node.
- Route-map loader returned an unknown node kind for
- Missing app/routes.ts path.
AI-assisted analysis of remix-run/remix@9696913134 (2026-08-27).
Data as JSON: /api/errors/ac40ef0a8f9422b7.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cli/src/lib/route-map.ts:255
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,
}
}
let method = Reflect.get(value, 'method')
let pattern = Reflect.get(value, 'pattern')
if (typeof method !== 'string' || typeof pattern !== 'string') {
throw new Error(`Route-map loader returned an invalid route leaf for "${name}".`)
}
View on GitHub (pinned to 9696913134)