{"record":{"id":"5c618862245bc9e2","repo":"grafana/k6","slug":"navigating-to-q-w","errorCode":null,"errorMessage":"navigating to %q: %w","messagePattern":"navigating to %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/js/modules/k6/browser/common/frame_manager.go","lineNumber":695,"sourceCode":"\tdefer lifecycleEvtCancel()\n\n\tfs, ok := frame.page.getFrameSession(cdp.FrameID(frame.ID()))\n\tif !ok {\n\t\tm.logger.Debugf(\"FrameManager:NavigateFrame\",\n\t\t\t\"fmid:%d fid:%v furl:%s url:%s fs:nil\",\n\t\t\tfmid, fid, furl, url)\n\n\t\t// Attaching an iframe to an existing page doesn't seem to trigger a \"Target.attachedToTarget\" event\n\t\t// from the browser even when \"Target.setAutoAttach\" is true. If this is the case fallback to the\n\n\t\t// main frame's session.\n\t\tfs = frame.page.mainFrameSession\n\t}\n\n\tvar err error\n\tnewDocumentID, err = fs.navigateFrame(frame, url, parsedOpts.Referer)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"navigating to %q: %w\", url, err)\n\t}\n\n\tif newDocumentID == \"\" {\n\t\t// It's a navigation within the same document (e.g., via anchor links or\n\t\t// the History API), so don't wait for a response nor any lifecycle\n\t\t// events.\n\t\treturn nil, nil //nolint:nilnil\n\t}\n\n\t// unblock the waiter goroutine\n\tclose(newDocIDIsReadyCh)\n\n\twrapTimeoutError := func(err error) error {\n\t\tif errors.Is(err, context.DeadlineExceeded) {\n\t\t\terr = &k6ext.UserFriendlyError{\n\t\t\t\tErr:     err,\n\t\t\t\tTimeout: parsedOpts.Timeout,\n\t\t\t}","sourceCodeStart":677,"sourceCodeEnd":713,"githubUrl":"https://github.com/grafana/k6/blob/93accf6570dcd306ca5e99cc44c393ee3797761b/internal/js/modules/k6/browser/common/frame_manager.go#L677-L713","documentation":"Thrown by FrameManager.NavigateFrame when the CDP Page.navigate command itself fails (fs.navigateFrame error) — the browser rejected or errored the navigation before any waiting began. Distinct from a timeout: this is the navigate call returning an error or an error net result, e.g. ERR_NAME_NOT_RESOLVED, ERR_ABORTED (another navigation superseded it), or a crashed target.","triggerScenarios":"page.goto('localhost:3000') without a scheme (parsed as relative and rejected); DNS failure in the test container; net::ERR_CONNECTION_REFUSED because the local server is not up; a download or redirect chain interrupting navigation (ERR_ABORTED); browser process crashed.","commonSituations":"Forgetting http:// in local URLs; k6 running in a container or CI that cannot resolve/reach the target host; the app under test restarting mid-test; concurrent navigations to the same page.","solutions":["Always pass a fully-qualified URL with scheme: page.goto('http://localhost:3000/')","Verify reachability from where k6 runs: curl the same URL from that container/host","Ensure the local dev server is up before the test (k6 browser tests need a live target)","Avoid issuing a second goto while the first is in flight"],"exampleFix":"// before\npage.goto('localhost:3000/app');\n\n// after\npage.goto('http://localhost:3000/app');","handlingStrategy":"validation","validationCode":"function assertGotoURL(u) {\n  const parsed = new URL(u);\n  if (!/^https?:$/.test(parsed.protocol)) throw new Error(`use http(s) URL, got ${u}`);\n}\nassertGotoURL(targetUrl);","typeGuard":"function isNavigateRejected(e) {\n  return e instanceof Error && /navigating to .*:/.test(e.message) && /ERR_/.test(e.message);\n}","tryCatchPattern":null,"preventionTips":["Always include the scheme in goto URLs","Smoke-test target reachability from the k6 host before the run"],"tags":["browser","goto","navigation","network","url"],"backgroundTag":null,"analyzedSha":"93accf6570dcd306ca5e99cc44c393ee3797761b","analyzedAt":"2026-08-15T21:23:27.118Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}