AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Strict Route Matching Drops Pages In Sibling Route Groups When A Parallel Slot Catch-All Is Present

Next.js 16.4+ strict route matching incorrectly treats a parallel slot catch-all from one route group as part of routes in sibling groups, causing valid pages to be reported as unmatched and failing dev/production webpack builds.

highConfidence 85%Next.jsAffected V16.4.0Affected V16.5.0-Canary.2

Origin Analysis

normalizeCatchAllRoutes injects catch-all slot routes based only on the URL path, without checking whether the slot belongs to the same route group as the page being matched. Under strict route matching, the unrelated slot makes the route appear incomplete for the sibling group's layout, so the page is pruned as unmatched.
1. Create an app with the structure shown in the issue: app/(dashboard)/layout.tsx with {children}{modal}, app/(dashboard)/page.tsx, app/(dashboard)/tasks/page.tsx, app/(dashboard)/@modal/default.tsx, app/(dashboard)/@modal/[...catchAll]/page.tsx, and app/(settings)/settings/page.tsx. 2. Run `next dev`. 3. Visit `/settings`; observe 404 and terminal error about unmatched page. 4. Run `next build --webpack`; the build fails with UnmatchedAppPagesError.

Fixing Code Block

Edge Case Audit

This change could affect apps that rely on cross-group slot catch-alls (unusual but possible with ambiguous layouts). Apply only to versions after 16.4.0 where strict matching is active. Before deploying, test routes that use parallel routes with shared URL prefixes and ensure the slot still renders. If regressions appear, roll back to `deprecated.looseRouteMatching: true` or revert the patch. The filtering is done in the build-time route normalization, so no runtime performance impact; however, ensure the helper `getRouteGroup` correctly parses route groups from page paths (including nested groups).

Ecosystem Topology