#34919·cypress

Surface network-layer request failures when a test fails

Author: cacieprinsCreated Sep 24, 2026Updated Sep 24, 2026
Labelstype: enhancementpkg/driverstage: proposal 💡pkg/servertype: error messagetopic: network

What would you like?

When a test fails and requests failed at the network layer during that test, name those failures in the error output.

Today Cypress reports the uncaught exception and nothing else:

The following error originated from your application code, not from Cypress.

  > Script error for "module-1359"

That is accurate and it points the wrong way. The exception is a symptom. The cause was a request the browser dropped.

What would help is a line appended to the existing error:

The following error originated from your application code, not from Cypress.

  > Script error for "module-1359"

3 requests failed at the network layer during this test:
  net::ERR_HTTP2_SERVER_REFUSED_STREAM  https://example.test/modules/module-1359.js
  net::ERR_FAILED                       https://example.test/modules/module-0204.js
  net::ERR_FAILED                       https://example.test/modules/module-0881.js

The same information belongs in the command log, so it is visible in open mode without reading the terminal.

Why is this needed?

#34874 is the motivating case. A page loaded many independent scripts over HTTP/2. The origin reached its keepalive_requests limit and sent GOAWAY. Chrome dropped a handful of the requests instead of replaying them on a new connection. The script elements fired onerror, the loader threw, and Cypress reported an uncaught application exception.

Everything Cypress printed was true. It still sent the reporter into their own JavaScript, where there was nothing to find.

Diagnosing it took a Chrome NetLog capture, a script to parse 900,000 events, and a standalone reproduction built to isolate the variables. The decisive fact was a count of requests that failed with net::ERR_FAILED. Cypress already had that count at the moment it printed the error.

This will keep happening. Cypress 16's native network path lets the browser hold real HTTP/2 connections to the origin, so transport failures that the HTTP/1.1 proxy used to absorb now reach tests. Every one of them currently surfaces as an error attributed to application code.

Other

The data is already collected, then discarded. packages/server/lib/browsers/cdp-protocol/cdp_automation.ts:87 subscribes Network.loadingFailed. The handler at line 223 is two lines long: it removes the pre-request and drops the event. params.errorText — the net::ERR_* string — is in hand and thrown away.

The message itself is uncaught.fromApp in packages/driver/src/cypress/error_messages.ts:2210.

Scope is presentational. Nothing about request handling changes. This collects failures per test and prints them.

This is not a mitigation, and should not be sold as one. Cypress cannot retry these requests. On the native path the browser owns the connection, and by the time the failure is observable the script element's onerror has already fired. There is no seam to intervene at. The goal is to stop misdirecting people, not to rescue the request.

Open questions:

  • Which failures qualify. Network.loadingFailed fires for ordinary cancellations, so canceled: true needs filtering at minimum. A navigation mid-test will also produce failures that are not interesting.
  • Whether to attach this to every failed test or only to uncaught exceptions. Attaching it to assertion failures may be noisier than it is worth.
  • How to cap the list. A bad HTTP/2 rollover can drop hundreds of requests in one test, so a count plus the first few is probably right.