Repository navigation
fix(console): stop resolving a cyclic Error.cause chain after 10 causes - #3338
Merged
wolfib merged 1 commit intoOct 26, 2026
Merged
Conversation
SymbolizedError resolved Error.cause recursively with no limit. For a cyclic chain such as `e.cause = e`, CDP returns a new object id on every lookup of the same object, so the recursion never ended and get_console_message held the page queue until the server restarted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3337
SymbolizedErrorfollowsError.causerecursively with no limit. With a cyclic chain likee.cause = eit never stops, because CDP returns a new object id for the same object on every lookup.get_console_messagehangs and keeps the page queue busy, so other tools (evenlist_pages) are stuck until the server restarts.This stops the lookup after 10 causes. The recursion now goes through private
#fromDetails()/#fromError()that carry the depth, and the publicfromDetails()/fromError()signatures stay the same. Detecting the cycle by object id doesn't work here since the ids are different every time.What changes for users:
get_console_messageforErrorarguments, andget_console_message/list_console_messageswithincludeStackTracesfor uncaught errors, show at most 10Caused by:entries. Chains with up to 10 causes look the same as before.Testing:
actual: 50, expected: 10, the mock cuts the chain at 50 so the test fails instead of hanging) and passes with the fix.npm run testpasses locally (Linux, Node 24, Chrome 156).get_console_messagecomes back right away andtake_snapshot/list_pageskeep working.Side note:
DebuggerWorkspaceBinding.createSymbolizedError()in devtools-frontend recurses onRemoteError.cause()the same way, but chrome-devtools-mcp doesn't use it, so this fix doesn't depend on an upstream change.