Skip to content

fix(fetch): preserve node error fields across serialization - #42562

Open
Dmitry Gozman (dgozman) wants to merge 1 commit into
microsoft:mainfrom
dgozman:fix-42532
Open

fix(fetch): preserve node error fields across serialization#42562
Dmitry Gozman (dgozman) wants to merge 1 commit into
microsoft:mainfrom
dgozman:fix-42532

Conversation

@dgozman

Copy link
Copy Markdown
Collaborator

Summary

  • Serialize the structured fields of a Node.js system error — code, errno, syscall, address, port, hostname — alongside the message, so APIRequestContext failures can be classified without parsing the error text.
  • Fields are whitelisted in one shared table in @protocol/serializers, and copied only when the runtime type matches the protocol type.

Fixes #42532

Serialize the structured fields of a Node.js system error (code, errno,
syscall, address, port, hostname) alongside the message, so that callers
can classify network failures without parsing the error text.

Fixes: microsoft#42532
@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

7 flaky ⚠️ [chromium-library] › library/video.spec.ts:495 › screencast › should capture static page in persistent context Radoslav Kirilov (@smoke) `@chromium-ubuntu-22.04-node24`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:257 › third party 'Partitioned;' cookies `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-library] › library/browsercontext-cookies-third-party.spec.ts:470 › top level 'Partitioned;' cookie and same origin iframe `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-emulate-media.spec.ts:144 › should keep reduced motion and color emulation after reload `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-event-request.spec.ts:181 › should return response body when Cross-Origin-Opener-Policy is set `@firefox-ubuntu-22.04-node20`
⚠️ [firefox-page] › page/page-goto.spec.ts:90 › should work with Cross-Origin-Opener-Policy `@firefox-ubuntu-22.04-node20`
⚠️ [webkit-library] › library/browsercontext-viewport-mobile.spec.ts:156 › mobile viewport › should emulate the hover media feature `@webkit-ubuntu-22.04-node20`

51341 passed, 1247 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chrome] › mcp/cli-json.spec.ts:133 › tab-list lists all tabs @mcp-macos-latest-chrome
❌ [firefox] › mcp/cli-core.spec.ts:131 › check @mcp-windows-latest-firefox

8325 passed, 1371 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

Hi, I'm the Playwright bot and I took a first look at the CI failures.

🟢 The two failures are pre-existing flakes — this PR is clear

Both failing tests are MCP CLI tests that don't touch fetch/error serialization, and both flip verdict across ~2000 runs on unrelated PRs. Nothing here points at this change.

Details

This PR only changes error serialization for APIRequestContext failures (serializeError/parseError plus a @protocol/serializers whitelist). Neither failing test exercises that path — one lists browser tabs, the other runs the MCP check command. The "tests 1" report had 0 failures (7 flaky), so the only reds are these two MCP tests.

Pre-existing flake / infra

Triaged by the Playwright bot - agent run

else
e = Object.assign(new PlaywrightError(error.error.message), { name: error.error.name });
e.stack = error.error.stack || '';
parseSystemErrorFields(error.error, e);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we just append it to the message, so that it works across langs?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: APIRequestContext errors lose structured fields (err.code is undefined) after cross-process serialization

2 participants