{"record":{"id":"b6698286fd781f5e","repo":"grafana/k6","slug":"errortext","errorCode":null,"errorMessage":"errorText","messagePattern":"errorText","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_manager.go","lineNumber":124,"sourceCode":"\n\tif frame.pendingDocument == nil {\n\t\tframe.pendingDocumentMu.Unlock()\n\t\treturn\n\t}\n\tif documentID != \"\" && frame.pendingDocument.documentID != documentID {\n\t\tframe.pendingDocumentMu.Unlock()\n\t\treturn\n\t}\n\n\tm.logger.Debugf(\"FrameManager:frameAbortedNavigation:emit:EventFrameNavigation\",\n\t\t\"fmid:%d fid:%v err:%s docid:%s fname:%s furl:%s\",\n\t\tm.ID(), frameID, errorText, documentID, frame.Name(), frame.URL())\n\n\tne := &NavigationEvent{\n\t\turl:         frame.URL(),\n\t\tname:        frame.Name(),\n\t\tnewDocument: frame.pendingDocument,\n\t\terr:         errors.New(errorText),\n\t}\n\tframe.pendingDocument = nil\n\n\tframe.pendingDocumentMu.Unlock()\n\n\tframe.emit(EventFrameNavigation, ne)\n}\n\nfunc (m *FrameManager) frameAttached(frameID cdp.FrameID, parentFrameID cdp.FrameID) {\n\tm.logger.Debugf(\"FrameManager:frameAttached\", \"fmid:%d fid:%v pfid:%v\",\n\t\tm.ID(), frameID, parentFrameID)\n\n\tm.framesMu.Lock()\n\tdefer m.framesMu.Unlock()\n\n\tif _, ok := m.frames[frameID]; ok {\n\t\tm.logger.Debugf(\"FrameManager:frameAttached:return\",\n\t\t\t\"fmid:%d fid:%v pfid:%v cannot find frame\",","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/frame_manager.go#L106-L142","documentation":"FrameManager.frameAbortedNavigation (frame_manager.go:104-128) builds a NavigationEvent whose err is the raw errorText received from CDP when the browser aborts a navigation. The text is typically a net::ERR_* code such as net::ERR_CONNECTION_REFUSED, net::ERR_ABORTED or net::ERR_CERT_AUTHORITY_INVALID, and it surfaces to scripts through page.goto()/waitForNavigation() failures and navigation events.","triggerScenarios":"The browser aborts navigation: the system under test is unreachable, DNS fails, TLS verification fails, a new navigation interrupts the current one (net::ERR_ABORTED), or the target is a download rather than a document.","commonSituations":"Wrong host/port in the script; proxy or firewall blocking the load generator; self-signed certificates without ignoreHTTPSErrors; clicking links that trigger file downloads; redirect storms.","solutions":["Verify the URL opens in a real browser from the same machine/network that runs k6","For TLS issues, create the browser context with ignoreHTTPSErrors: true or import the CA","Configure proxy settings in browser.launch() if the environment requires an egress proxy","Treat downloads differently (don't navigate to them); assert on the specific net::ERR text to distinguish causes"],"exampleFix":"// before\nawait page.goto('https://self-signed.internal.example.com/'); // net::ERR_CERT_AUTHORITY_INVALID\n\n// after\nconst context = await browser.newContext({ ignoreHTTPSErrors: true });\nconst page = await context.newPage();\nawait page.goto('https://self-signed.internal.example.com/');","handlingStrategy":"try-catch","validationCode":"// Sanity-check reachability before navigating the real browser\nconst res = await http.get(url);\nif (res.status >= 400 || res.error) { /* fix env/proxy/TLS before driving the browser */ }","typeGuard":null,"tryCatchPattern":"try {\n  await page.goto(url, { waitUntil: 'load' });\n} catch (e) {\n  const msg = String(e.message || e);\n  if (msg.includes('ERR_CONNECTION_REFUSED')) { /* WUT down or wrong port */ }\n  else if (msg.includes('ERR_CERT')) { /* retry with ignoreHTTPSErrors context */ }\n  else { throw e; }\n}","preventionTips":["Confirm the URL opens from the same network the load generator runs on","Configure proxy and ignoreHTTPSErrors up front for restricted environments","Don't navigate to download URLs; intercept them or assert via HTTP requests"],"tags":["browser","navigation","network","cdp"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}