✦ Continue with Google
AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Server Action RevalidateTag Triggers Hard Navigation To 404 In Parallel Routes

Using a Server Action that calls revalidateTag inside an intercepted parallel route modal causes a full page reload to the current URL, resulting in a 404 error.

highConfidence 72%Next.jsAffected V16.2.4

Origin Analysis

Next.js's router cache invalidation after a Server Action revalidation dispatches a refresh reducer that cannot reconcile the active parallel route state. It falls back to a hard navigation (`window.location.reload()`) targeting the current URL. Because the URL was reached through an intercepted route, the router may include stale or synthetic path segments that do not map to a real page, leading to a 404 when requested as a document.
1. Clone the reproduction repository. 2. Run `npm install && npm run dev`. 3. Navigate to `/test`. 4. Open the first modal and click through to the detail page (`/test/42`). 5. Open the second modal. 6. Click the update tag button. 7. Observe a full page reload and a 404 error page.

Fixing Code Block

Edge Case Audit

This is a temporary workaround and may not work in all parallel route configurations or with deeply nested intercepted routes. If a real fix is released in Next.js, revert this change. The use of `router.replace` can cause a history entry loss if the user expects back-button navigation to return to the previous modal state. Test thoroughly under concurrent updates and ensure the database update is idempotent. If the hard refresh still occurs, replace the server action with a traditional API route and use `router.refresh()` explicitly.

Ecosystem Topology