Skip to content

fix(network): improve error message when response.body() is called after navigation#41527

Merged
Skn0tt merged 1 commit into
microsoft:mainfrom
Zelys-DFKH:fix-41512
Jul 1, 2026
Merged

fix(network): improve error message when response.body() is called after navigation#41527
Skn0tt merged 1 commit into
microsoft:mainfrom
Zelys-DFKH:fix-41512

Conversation

@Zelys-DFKH

Copy link
Copy Markdown
Contributor

Summary

  • Chrome and WebKit throw cryptic ProtocolErrors when response.body() is called after navigation: No resource with given identifier found / Missing content of resource for given requestId
  • Catches these in internalBody() and appends a navigation-race explanation so users know what happened

Fixes #41512

…ter navigation

When response.body() / response.text() / response.json() are called
after the page has navigated, Chrome and WebKit throw a cryptic
ProtocolError ("No resource with given identifier found" or "Missing
content of resource for given requestId"). Wrap the protocol call in a
try/catch and append a human-readable explanation when a ProtocolError
is detected.

Fixes: microsoft#41512
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Test results for "MCP"

2 failed
❌ [chromium] › mcp/cli-killall.spec.ts:42 › kill-all kills filtered dashboard pid @mcp-macos-latest-chromium
❌ [webkit] › mcp/http.spec.ts:349 › client should receive list roots request @mcp-ubuntu-latest-webkit

7459 passed, 1132 skipped


Merge workflow run.

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Test results for "tests 1"

3 failed
❌ [chromium-library] › library/browsercontext-add-init-script.spec.ts:28 › should work without navigation, after all bindings @chromium-ubuntu-22.04-arm-node20
❌ [chromium-library] › library/browsercontext-expose-function.spec.ts:77 › should be callable from-inside addInitScript @chromium-ubuntu-22.04-arm-node20
❌ [webkit-page] › page/page-network-response.spec.ts:454 › should give a readable error when response.body() races with navigation @webkit-ubuntu-22.04-node20

4 flaky ⚠️ [chromium-library] › library/chromium/chromium.spec.ts:211 › should intercept service worker requests (main and within) `@chromium-ubuntu-22.04-arm-node20`
⚠️ [chromium-library] › library/chromium/chromium.spec.ts:177 › serviceWorker(), and fromServiceWorker() work `@chromium-ubuntu-22.04-node22`
⚠️ [firefox-library] › library/heap.spec.ts:223 › should not leak workers `@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`

49173 passed, 1164 skipped


Merge workflow run.

@Skn0tt Skn0tt merged commit 1d7325a into microsoft:main Jul 1, 2026
44 of 48 checks passed
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.

Improve error message when response.body() races with page navigation

3 participants