ISSUE DESCRIPTION A self-throwing global error component renders no last-resort UI If…
- User
ISSUE DESCRIPTION
A self-throwing global error component renders no last-resort UI
If the global error component itself fails, return the built-in valid HTML fallback with the expected successful fallback status while preserving response headers and cookies. Local error boundaries and framework navigation/control-flow signals must retain their existing semantics, and the original boundary exception must not be exposed.
Interface
No new public interfaces are introduced.
ADDITIONAL ADVICE
Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use
git checkout <file>to restore the file to its original state. You can also reset all changes in the repository usinggit reset --hardcommand. Additionally, you can usegit stashandgit stash popto temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you callsubmit) usinggit statusorgit diffcommands. However you don't need to usegit addorgit commitbefore submitting your changes. In fact,submitonly submits currently unstaged changes because it usesgit diffto get the changes that need to be submitted.CHECKLIST
Before submitting your solution, please go over the following checklist and make sure you've done everything:
- If an error was reported in the issue description, I have successfully reproduced it.
- If an error was reported in the issue description, I have confirmed that my fix resolves the error.
- I have thought about edge cases and made sure my fix handles them as well.
- I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.
Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!
(Current directory: /vinext, current file: none) bash-$
- Assistant
I'll start by exploring the repository structure and locating code related to the global error component and fallback UI.
- Assistant
I'll search the codebase for global error handling and last-resort fallback UI.
- Assistant
There's an app-fallback-renderer.test.ts - that seems very relevant. Let me also search for global-error related files.
- Assistant
I'll inspect the fallback renderer, default global error module, and related tests.
- Assistant
Hmm, rg might not be available that way. Let me try differently.
- Assistant
Let me look at the relevant source files and tests.
- Assistant
Let me read the fallback renderer and error handler files in full, as well as related tests.
- Assistant
Let me continue reading the file and also look for how global error failures are handled.
- Assistant
I'll dig into boundary rendering and existing last-resort HTML fallbacks.
- Assistant
Let me check the agents/skills folder and also look for any PR description or agent notes related to this issue.
- Assistant
There's a dedicated global-error test — I'll inspect it and the related source next.
- Assistant
I'll search recent history and the error-path sources for self-throw / last-resort handling.
- Assistant
I'll inspect boundary/error modules and search Next.js sources in node_modules for the last-resort path.
- Assistant
Let me look more carefully at how Next.js handles when global-error itself throws. Also look for ErrorBoundary and how it handles nested errors.
- Assistant
Let me look at how Next.js handles rendering ErrorApp when GlobalError throws, and also look at vinext's existing error render path more carefully.
- Assistant
Next I'll examine vinext's global-error render path and any existing unit tests covering that failure mode.
- Assistant
I'll read the stream and boundary-render modules around the global-error rerender logic.
- Assistant
Let me read more of app-page-boundary-render.ts specifically the renderAppPageErrorBoundary function, and also the ErrorBoundary component.
- Assistant
Let me also look at how SSR stream handles errors when the error boundary itself fails, and look at pages-page-handler for the similar last-resort pattern.
- Assistant
I'll look for incomplete TODOs, failing tests, and HTML fallback documents tied to this path.
- Assistant
Let me look at renderAppPageBoundaryElementResponse fully - that's where the boundary is rendered to HTML and might fail if global error throws.
- Assistant
Let me look at renderAppPageBoundaryResponse and also app-page-render for recovery when global error fails.
- Assistant
I'll scan unit tests and recent changes specifically covering global-error self-failure.
- Assistant
Let me look at the app-page-boundary-render test file and fallback-renderer tests for clues about expected behavior when global error throws.
- Assistant
I'll inspect Next.js tests and base-server handling for when global-error itself throws.
- Assistant
I'll check AGENTS.md and git history/status for anything about this failure mode.
- Assistant
I'll inspect Next's getFallbackErrorComponents path and vinext's corresponding last-resort handling.
- Assistant
I'm examining error recovery in app-page-render when global-error throws.
- Assistant
I'll examine Next's ErrorBoundaryHandler fallback and any static HTML last resort.
- Assistant
Found the static HTML fallback — I'll inspect that Next stream helper and any vinext mirror.
- Assistant
I'll search for related issue numbers and inspect full getErrorRSCPayload / seed data.
- Assistant
I'll inspect AppRouter’s root ErrorBoundary use of GlobalError.
- Assistant
There's RootErrorBoundary! Let's look at that.
- Assistant
I'll check vinext's ErrorBoundary and whether a nested default global-error fallback already exists.
- Assistant
I'll check how SSR dentry wraps App Router with the global ErrorBoundary.
- Assistant
I'll check app-page-route-wiring wrapping and reproduce with a focused local Script.
- Assistant
I'll write a quick reproduction of a self-throwing global-error using the existing boundary-render helpers.
- Assistant
Let me reproduce the current behavior with a temporary test script.
- Assistant
Need to put the script in the repo so packages resolve.
- Assistant
I'll look for helper utilities that build last-resort HTML error responses.
- Assistant
I'll examine element-builder's global-error wiring and app-fallback-renderer options path.
- Assistant
I'll trace how GlobalError is invoked during the error SSR path.
- Assistant
Let me look for how Next tests self-throwing global error.
- Assistant
I'll implement try/catch recovery and a built-in HTML fallback for failed global-error renders.
- Assistant
Implementing last-resort recovery: double-wrapping global error boundariesполнить and catching self-throws to serve built-in HTML.
- Assistant
I'll inspect error styles and implement the boundary-render fixes.
- Assistant
I'll add the last-resort HTML helper and update error-boundary rendering.
- Assistant
I'll update boundary wrapping and add last-resort recovery helpers.
- Assistant
I'll update the wrapping logic and
renderAppPageErrorBoundarynext. - Assistant
I'll fix the typos and finish updating
renderAppPageErrorBoundary. - Assistant
Need to use sed or go to lineen 229.
- Assistant
The first replace worked. The second one about "built謾-in" needs goto. Let me fix that and rewrite renderAppPageErrorBoundary.
- Assistant
The sed might have fixed it. Let me check and rewrite renderAppPageErrorBoundary.
- Assistant
Now I'll rewrite renderAppPageErrorBoundary with try/catch recovery.
- Assistant
I introduced typos—rewriting the whole function cleanly now.
- Assistant
The edit tool is introducing garbage — I'll rewrite the function with a Python script for a clean result.
- Assistant
No python3? Try node or python.
- Assistant
Let me verify the file end is clean.
- Assistant
File looks clean. Now update route-wiring for double wrap.
- Assistant
I'll update route-wiring communication to double wrap.
- Assistant
Wait - I may have removed AppRouterScrollTarget import. Let me check.
- Assistant
I accidentally removed the AppRouterScrollTarget import. Need to fix that.
- Assistant
Now update the wrapping site at the end of route-wiring.
- Assistant
I'll verify exports and rebuild so we can run the unit tests.
- Assistant
Build completed. Now update the repro script and, run it, and run unit tests.
- Assistant
I'll branch the repro to cover default UI failure and no original leak, then run unit tests.
- Assistant
All three cases work as expected. Now run unit tests for boundary-render and fallback-renderer.
- Assistant
Timed out. Let me try with vitest more directly and longer timeout, or check how tests are run.
- Assistant
Tests seem slow/hanging. Let me try running vp test with a single file and wait longer, or check vite config.
- Assistant
Boundary render tests pass. Let me run more related tests.
- Assistant
I'll clean up temps and inspect the final diff.
- Assistant
I'm doing a final related unit-test pass, then submitting.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
claude-sonnet-5Compare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-35B-A3BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →
Qwen/Qwen3.6-27BCompare side by side →