CypressError: cy.visit() failed trying to load the page
Diagnoses Cypress cy.visit() load failures: server down, wrong baseUrl, or network blocks. Use when the test fails at cy.visit() with a load error. Not for in-page assertion failures after a successful visit.
TL;DR
cy.visit() fails when Cypress cannot load the page at all: the dev server is not running, the URL is wrong, or something blocks the request. Verify the server responds with curl first, then fix the URL, the server startup order, or the blocking proxy.
Error
CypressError: `cy.visit()` failed trying to load the service URL for that host and port.
We attempted to make an http request to this URL but the request failed without a response.Steps
- In a terminal, run
curl -s -o /dev/null -w "%{http_code}" YOUR_HOST/. Expected: 200. Anything else means the server is the problem, not Cypress. - If curl fails, start the dev server before Cypress (for example with
start-server-and-test). Expected: curl returns 200, thency.visit()succeeds. - Check
baseUrlincypress.config.jsmatches the real server port. Expected: the port in the config equals the port the server listens on. - If the page loads in a real browser but not in Cypress, check for proxy or VPN interference and try
cy.visit()with the IP instead of the hostname. Expected: isolates DNS or proxy issues. - For
ERR_ABORTEDvariants, the page itself cancels navigation (auth redirect loops); addfailOnStatusCode: falsetemporarily to see the actual response. Expected: you see the real status code instead of a load error.
When to use
- Failure happens on
cy.visit(), before any page interaction. - The same URL fails from curl, or works in a normal browser but not Cypress.
When not to use
- The page loads but assertions on it fail (use the cy.get timeout skill).
- The failure is
We detected that the Chrome version(browser binary issue).
Tool compatibility
- Cypress 10 through 14;
start-server-and-testfor server orchestration.
Variant phrasings
cy.visit failed without a response
The request never completed: server down, refused connection, or DNS failure.
cy.visit() timed out
The server accepted the connection but never sent a full page; check for hanging middleware.
Why it happens
Cypress drives a real browser to a real URL. If nothing listens there, or the URL is wrong, there is no page to test. CI is the classic trigger: tests start before the server is ready.
Edge cases
cy.visit()to an external URL (not under test) hits cross-origin limits; keep visits on the app under test.- Service workers from a previous run can serve stale failures; clear them with
cy.clearAllCookies()plus a fresh profile in CI. - HTTPS dev servers with self-signed certs need the cert trusted by the Cypress browser.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_A3eUaRJNxozO6qaVgQ-Fww
Maintainer review
No maintainer verification is recorded for this version.
This records the version a maintainer checked. It does not assert that the version is the latest upstream release.